作者:飞鱼 | 来源:互联网 | 2017-05-14 01:36
这种XML数据我想PHP写入MYSQL数据库,怎么写?vol.stock.hexun.comchartsCloseShareInfo_3.ashx?code600111------解决方案--------------------PHPcode$confile_get_contents("vol.st
这种XML数据我想PHP写入MYSQL数据库,怎么写?
http://vol.stock.hexun.com/charts/Close/Share/Info_3.ashx?code=600111------解决方案--------------------
PHP code
$con=file_get_contents("http://vol.stock.hexun.com/charts/Close/Share/Info_3.ashx?code=600111");
$xml = simplexml_load_string($con);
foreach($xml->Item as $v){
$arr=(array)$v->attributes();
$ar[]=$arr['@attributes'];
}
print_r($ar); //形成一个二维数组。插入库应该难不倒你了吧!