SimpleXMLElement Object
(
[@attributes] => Array
(
[ts_sec] => 1345538437
[ts_usec] => 720077
)
[node] => SimpleXMLElement Object
(
[@attributes] => Array
(
[index] => 0
[name] => bridgesd
[from] => local
)
[item] => SimpleXMLElement Object
(
[@attributes] => Array
(
[index] => 0
[name] => lagg0
[handle] => 0
[level] => 0
[ischild] => 0
[parent] => 0
)
[attr] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => bytes
[rx] => 159379363180211
[tx] => 38894903367026
[rate_rx] => 3.46MiB
[rate_tx] => 1.43MiB
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => packets
[rx] => 351830176630
[tx] => 282071482490
[rate_rx] => 6.61K
[rate_tx] => 6.32K
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => errors
[rx] => 0
[tx] => 81
[rate_rx] => 0
[rate_tx] => 0
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => drop
[rx] => 0
[tx] => 0
[rate_rx] => 0
[rate_tx] => 0
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => multicast
[rx] => 0
[tx] => 0
[rate_rx] => 0
[rate_tx] => 0
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => collisions
[rx] => 0
[tx] => 0
[rate_rx] => 0
[rate_tx] => 0
)
)
)
)
)
)
上面是我获取到的数据,
下面是我的代码:
include_once ("conn.php");
$arrurl="http://119.188.27.194:88/";
$Contents=file_get_contents($arrurl);
$xml=simplexml_load_string(str_replace('-','',$Contents));
print_r($xml);
现在要把上面的数据分字段存入数据库,该怎么做?用foreach遍历数组么?
我是小白.只能求助,各种因由啊!!
(
[@attributes] => Array
(
[ts_sec] => 1345538437
[ts_usec] => 720077
)
[node] => SimpleXMLElement Object
(
[@attributes] => Array
(
[index] => 0
[name] => bridgesd
[from] => local
)
[item] => SimpleXMLElement Object
(
[@attributes] => Array
(
[index] => 0
[name] => lagg0
[handle] => 0
[level] => 0
[ischild] => 0
[parent] => 0
)
[attr] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => bytes
[rx] => 159379363180211
[tx] => 38894903367026
[rate_rx] => 3.46MiB
[rate_tx] => 1.43MiB
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => packets
[rx] => 351830176630
[tx] => 282071482490
[rate_rx] => 6.61K
[rate_tx] => 6.32K
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => errors
[rx] => 0
[tx] => 81
[rate_rx] => 0
[rate_tx] => 0
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => drop
[rx] => 0
[tx] => 0
[rate_rx] => 0
[rate_tx] => 0
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => multicast
[rx] => 0
[tx] => 0
[rate_rx] => 0
[rate_tx] => 0
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[name] => collisions
[rx] => 0
[tx] => 0
[rate_rx] => 0
[rate_tx] => 0
)
)
)
)
)
)
上面是我获取到的数据,
下面是我的代码:
include_once ("conn.php");
$arrurl="http://119.188.27.194:88/";
$Contents=file_get_contents($arrurl);
$xml=simplexml_load_string(str_replace('-','',$Contents));
print_r($xml);
现在要把上面的数据分字段存入数据库,该怎么做?用foreach遍历数组么?
我是小白.只能求助,各种因由啊!!
解决方案 »
- 同时连一台机器上的同一个mysql不同的库,报错问题
- 保存文件名日文乱码,高分请教
- php生成xml文件的问题
- php+txt 还是php+mysql 请大侠指点下
- 最后的分了 。Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';是什么意思
- ========= 服务器端怎样获得客户端证书的一些信息 =========
- PHP可否获取客户端的MAC地址?
- 征求意见:我该用ASP还是PHP呢?就是我该朝哪个方向发展呢?
- 请问正则式怎么写
- 编写一个在1,2,...,9(顺序不能变)数字之间插入+或者-或什么都不插入,使得计算结构总是100的程序,并输出所有的可能性。
- 如何使用PDO获取多个结果集??
- PHPExcel循环读取excel,列数超过z,比较出问题
http://blog.csdn.net/guoguo1980/article/details/2436318