object(SimpleXMLElement)#9 (1) {&nbs"/>  object(SimpleXMLElement)#9 (1) {&nbs">

Home >Backend Development >PHP Tutorial >请教PHP里XPath查找出数据后怎么让它不返回数据结构只返回值

请教PHP里XPath查找出数据后怎么让它不返回数据结构只返回值

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:11:391208browse

请问PHP里XPath查找出数据后如何让它不返回数据结构只返回值?

		$data=$xml->xpath("[email protected]");

上面一段code会输出如下内容
array(1) { [0]=> object(SimpleXMLElement)#9 (1) { ["@attributes"]=> array(1) { ["msg"]=> string(24) "小王子" } } }
请问如何让它只返回msg里边的内容,而不返回数据路径"@attributes
------解决思路----------------------

$data=$xml->xpath("[email&#160;protected]");<br /><br />$str = (string)$data[0];

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn