2009-10-12 64 views
2

我試圖加載XML在PHP加載XML在PHP給錯誤

$doc = new DOMDocument(); 
$doc->load("LoginVal.xml"); 

我得到一個錯誤

Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in C:\Program Files\Apache Group\Apache2\htdocs\hello.php on line 5

Fatal error: Call to undefined method domdocument::load() in C:\Program Files\Apache Group\Apache2\htdocs\hello.php on line 7

問候, 與Hemant

+0

PHP的哪個版本?根據文檔, – Boldewyn 2009-10-12 12:14:06

回答

0

看看here中的評論,這看起來像一個已知的問題(特別是評論#2)。

0

請閱讀用戶意見DOMDocument::__construct()。在Windows機器上使用PHP5時(這很可能與您的配置相匹配)有一個關於這個錯誤的討論。我引用christian dot reinecke at web dot de

[...] make sure you're not overwritting this dom library by another (f.e. extension=php_domxml.dll in php.ini). XAMPP f.e. delivers its standard version with php_domxml.dll which ends up in this error message

確保沒有php_domxml.dll -extension在php.ini

0

嘗試完整的文件路徑

此致

$doc = new DOMDocument(); 
$doc->load("LoginVal.xml"); 

嘗試

$doc = new DOMDocument(); 
$doc->load("/path/to/LoginVal.xml");