在PHP中访问数组中的项
在PHP中,我希望获得customer name标记的文本值。我写了这段代码,但它不起作用。你能帮我做这个吗?多谢各位在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。您错过了一个$符号,
$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 ();