dongshuohuan5291 2014-09-26 18:32
浏览 52
已采纳

如何将PHP通知和警告发送到error_log而不是网页?

I am not sure why I can't find information about this on the internet but php prints notices and warnings on the web page, which is unacceptable. I know that I can turn it off programmatically on each page, but how do I set a config to just send these errors to my error log? I've been googling like crazy and can't figure it out.

Stuff like this:

<b>Notice</b>: Use of undefined constant LOG_ERROR - assumed 'LOG_ERROR' in  on line <b>12</b><br /> <br /> <b>Warning</b>: syslog() expects parameter 1 to be long, string given in
  • 写回答

1条回答 默认 最新

  • doz22551 2014-09-26 18:35
    关注
    ini_set('display_errors', '0');
    

    You can include that line at the top of any page, but it's preferred to set it in the php.ini file

    display_errors = Off
    

    Find 'display_errors' in the ini file and set it to off. Then whenever you need a page to display errors for debugging, you can just set:

    ini_set('display_errors', '1');
    

    At the top of the page.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)