l">
时间:2021-07-01 10:21:17 帮助过:2人阅读
现有代码:
/* $xmlstring 原内容:
-
*/
$xmldoc = new DOMDocument();
$xmldoc->loadXML($xmlstring);
$users = $xmldoc->getElementsByTagName('GetUserInfo');
foreach ($users as $user) {
$html .= 'outputCustomer:'.get_txt($user,'Customer').'
';
$html .= 'outputGeo:'.get_txt($user,'GeocallCLI').'
';
}
echo $html;
function get_txt($parent, $name) {
$nodes = $parent->getElementsByTagName($name);
return $nodes->item(0)->nodeValue;
}
?>
另问怎样只输出
现有的PHP代码输出XML节点时,只能输出第一个同名节点内容"100". 请问怎样才能输出所有节点的内容呢?
现有代码:
/* $xmlstring 原内容:
-
*/
$xmldoc = new DOMDocument();
$xmldoc->loadXML($xmlstring);
$users = $xmldoc->getElementsByTagName('GetUserInfo');
foreach ($users as $user) {
$html .= 'outputCustomer:'.get_txt($user,'Customer').'
';
$html .= 'outputGeo:'.get_txt($user,'GeocallCLI').'
';
}
echo $html;
function get_txt($parent, $name) {
$nodes = $parent->getElementsByTagName($name);
return $nodes->item(0)->nodeValue;
}
?>
另问怎样只输出
自己顶上, 哪位大侠能解答下么
我顶