Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP中访问数组中的项_Php_Arrays_Dom - Fatal编程技术网

在PHP中访问数组中的项

在PHP中访问数组中的项,php,arrays,dom,Php,Arrays,Dom,在PHP中,我希望获得customer name标记的文本值。我写了这段代码,但它不起作用。你能帮我做这个吗?多谢各位 $customerName = $dom->get_elements_by_tagname("item"); $customernameValue = customerName[0]-> first_child()->node_value (); 我不熟悉您正在使用的库,但看起来您只是错过了第二行的$beforecustomerName。您错过了一个$符号,

在PHP中,我希望获得customer name标记的文本值。我写了这段代码,但它不起作用。你能帮我做这个吗?多谢各位

$customerName = $dom->get_elements_by_tagname("item");
$customernameValue = customerName[0]-> first_child()->node_value ();

我不熟悉您正在使用的库,但看起来您只是错过了第二行的$before
customerName

您错过了一个
$
符号,请尝试以下操作:

$customerName = $dom -> get_elements_by_tagname ("item");
$customernameValue = $customerName[0] -> first_child() -> node_value ();