我有一個腳本,在我們的開發服務器上正常工作,但死在客戶端服務器上。如何捕獲死亡的PHP腳本錯誤(Perl有eval)?
error_reporting(E_ALL);
if (function_exists('simplexml_load_file')) echo "function exists";
if (file_exists('test.xml'))
{
echo("<hr>just about to read local xml file :".__LINE__);
$xml = simplexml_load_file('test.xml'); // dies here
在Perl中,你可以用eval捕獲這樣的錯誤,在PHP中是否有任何等價的東西?
彼得 它從來沒有從simplexml_load_file返回,試過你的建議無濟於事 – zzapper 2009-12-15 17:19:33
是他們的服務器PHP 5? – 2009-12-15 17:29:58
是的,他們的系統管理員在工作,但也有問題 – zzapper 2009-12-15 17:34:33