我想捕捉这个错误:
$a[1] = 'jfksjfks';
try {
$b = $a[0];
} catch (Exception $e) {
echo "jsdlkjflsjfkjl";
}
实际上,我在以下行中收到此错误:$parse = $xml->children[0]->children[0]->toArray();
in fact, I got this error on the following line:
$parse = $xml->children[0]->children[0]->toArray();
您需要定义您的自定义错误处理程序,例如:
You need to define your custom error handler like:
<?php
set_error_handler('exceptions_error_handler');
function exceptions_error_handler($severity, $message, $filename, $lineno) {
if (error_reporting() == 0) {
return;
}
if (error_reporting() & $severity) {
throw new ErrorException($message, 0, $severity, $filename, $lineno);
}
}
$a[1] = 'jfksjfks';
try {
$b = $a[0];
} catch (Exception $e) {
echo "jsdlkjflsjfkjl";
}
这篇关于如何捕获此错误:“注意:未定义偏移量:0"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!