修改opencart的index.php 如果是后台就修改admin下的index.php,在 <?php 表情下面加如下代码即可在页面或者审核里输出错误日志。
error_reporting(E_ALL); //E_ALL
function cache_shutdown_error() {
$_error = error_get_last();
if ($_error && in_array($_error['type'], array(1, 4, 16, 64, 256, 4096, E_ALL))) {
echo '<font color=red>你的代码出错了:</font></br>';
echo '致命错误:' . $_error['message'] . '</br>';
echo '文件:' . $_error['file'] . '</br>';
echo '在第' . $_error['line'] . '行</br>';
}
}
register_shutdown_function("cache_shutdown_error");
error_reporting(E_ALL); //E_ALL
function cache_shutdown_error() {
$_error = error_get_last();
if ($_error && in_array($_error['type'], array(1, 4, 16, 64, 256, 4096, E_ALL))) {
echo '<font color=red>你的代码出错了:</font></br>';
echo '致命错误:' . $_error['message'] . '</br>';
echo '文件:' . $_error['file'] . '</br>';
echo '在第' . $_error['line'] . '行</br>';
}
}
register_shutdown_function("cache_shutdown_error");
本文介绍如何在Opencart中配置错误日志输出功能,通过修改index.php文件实现错误信息的显示,包括错误类型、文件名及行号等详细信息。
1421

被折叠的 条评论
为什么被折叠?



