现有的php代码输出xml节点时,只能输出第一个同名节点内容100. 请问怎样才能输出所有节点的内容呢?
现有代码:
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;
}
?>
另问怎样只输出 idcn节点中号前面部份, 即 id 而不是 id*cn
回复内容: 现有的php代码输出xml节点时,只能输出第一个同名节点内容100. 请问怎样才能输出所有节点的内容呢?
现有代码:
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;
}
?>
另问怎样只输出 idcn节点中号前面部份, 即 id 而不是 id*cn
自己顶上, 哪位大侠能解答下么
我顶