不能使用xmldocfile()

zxyufan 2003-06-07 11:03:48
x01.php :

<?
$doc = xmldocfile("board.xml");
?>


报错:

Warning: xmldocfile() [function.xmldocfile]: warning: in D:\Apache Group\Apache2\htdocs\Test\x02.php on line 3

Warning: xmldocfile() [function.xmldocfile]: failed to load external entity "board.xml" in D:\Apache Group\Apache2\htdocs\Test\x02.php on line 3



board.xml :

<?xml version="1.0" encoding="GB2312"?>
<board>
</board>
...全文
24 点赞 收藏 5
写回复
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuzuning 2003-06-09
若board.xml在D:\Apache Group\Apache2\htdocs\Test\下则
$doc = xmldocfile(realpath("board.xml"));

此类扩展需要有绝对路径,函数realpath参照程序所在路径构造目标文件的绝对路径。需自行保证得到的路径真实有效。
回复
zxyufan 2003-06-09
Warning: domxml_open_file() [function.domxml-open-file]: warning: in D:\Apache Group\Apache2\htdocs\Test\x02.php on line 3

Warning: domxml_open_file() [function.domxml-open-file]: failed to load external entity "board.xml" in D:\Apache Group\Apache2\htdocs\Test\x02.php on line 3

ini里开了的 dll也copy到系统目录下了的
回复
21bird 2003-06-08
改用domxml_open_file()就对了;)
回复
21bird 2003-06-08
看错了。原因在这:

Deprecated functions
There are quite a few functions that do not fit into the DOM standard and should no longer be used. These functions are listed in the following table. The function DomNode_append_child() has changed its behaviour. It now adds a child and not a sibling. If this breaks your application, use the non-DOM function DomNode_append_sibling().

表格 1. Deprecated functions and their replacements
==========================
Old function New function
--------------------------
xmldoc domxml_open_mem()
xmldocfile domxml_open_file()
domxml_new_xmldoc domxml_new_doc()
……
回复
21bird 2003-06-08
打开php.ini里的:
extension=php_domxml.dll
回复
发动态
发帖子
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
社区公告
暂无公告