doulezhi5326 2014-01-17 19:05
浏览 37

如何避免使用Zend的致命php异常的白页?

I've seen this question asked and answered a few times but none of the solutions work for me. Also Zend Framework might complicate things here. I know the best solution is to fix the errors, but is there really no best practice to avoid a white page? I mean my code is pretty damn perfect, even tested sometimes, but nobody is perfect. I've tried:

function exception_error_handler($errno, $errstr, $errfile, $errline ) {
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");

also

register_shutdown_function('forward_fatal');
function forward_fatal(){
    header("Location: index.html");
}

Still getting white page on fatal exception.

  • 写回答

1条回答 默认 最新

  • doudaochu1699 2014-01-17 19:12
    关注

    1) read your log files

    2) if your log files don't explain what went wrong then fix the error logging

    3) in the very rare event where PHP crashed and core-dumped, then go find your core file and work out why it failed

    4) don't write code with fatal errors in it

    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题