Php 获取XML表单网站
我尝试从其他网站获取数据,如下所示: 我还有以下php代码:Php 获取XML表单网站,php,xml,Php,Xml,我尝试从其他网站获取数据,如下所示: 我还有以下php代码: $xml=file_get_contents('http://www.wowhead.com/item=65891&xml'); $xml= simplexml_load_string($xml); var_dump($xml->item->name); 但它不起作用。要获取名称文本内容,请使用\uu toString()方法: var_dump($xml->item->name-&
$xml=file_get_contents('http://www.wowhead.com/item=65891&xml');
$xml= simplexml_load_string($xml);
var_dump($xml->item->name);
但它不起作用。要获取名称文本内容,请使用
\uu toString()
方法:
var_dump($xml->item->name->__toString());
//output: string 'Vial of the Sands' (length=17)
要获取名称文本内容,请使用
\uuu toString()
方法:
var_dump($xml->item->name->__toString());
//output: string 'Vial of the Sands' (length=17)
这将为您提供以下类型的对象:
$xml->item->name
您可以使用其方法获取字符串内容:
var_dump($xml->item->name->__toString());
这将为您提供以下类型的对象:
$xml->item->name
您可以使用其方法获取字符串内容:
var_dump($xml->item->name->__toString());
其返回空名称其返回空名称