icebolt
(icebolt)
中级会员
 
老会员
UID 13413
精华
0
积分 441
帖子 443
金钱 441 喜悦币
威望 0
人脉 0
阅读权限 30
注册 2002-3-25 来自 河北
状态 离线
|
[广告]: Enom域名自助付费 自助注册 自助PUSH 主流域名COM等一律57.99元年
很奇怪的问题
<?php $XMLstr = "<"."?"."xml version=\"1.0\""." ?".">"; $XMLstr.="<employee><name>Matt</name><position type=\"contract\">Web Guy</position></employee>"; $file=$_SERVER["DOCUMENT_ROOT"]."/test/book/books.xml"; //$doc = XMLdocfile($file); $doc = XMLdoc($XMLstr); $employee = $doc->root(); $nodes = $employee->children(); while ($node = array_shift($nodes)){ if ($node->tagname == "position"){ $position = $node; break; } } $type = $position->getattr("type"); $text_node = array_shift($position->children()); $text = $text_node->content; echo "position: $text<BR>"; echo "type: $type"; ?> 运行显示错误:
Fatal error: Call to undefined function: getattr() in F:\Apache2\htdocs\test\book\index.php on line 15
|
|