不能使用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>
...全文
83 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
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到系统目录下了的
某鸟 2003-06-08
  • 打赏
  • 举报
回复
改用domxml_open_file()就对了;)
某鸟 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()
……
某鸟 2003-06-08
  • 打赏
  • 举报
回复
打开php.ini里的:
extension=php_domxml.dll

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧