dpda53918 2014-10-27 17:36
浏览 84
已采纳

如何抑制php警告?

I'm have a problem supressing php warnings - they keep showing up on my php pages. For example, this one:

Strict Standards: Non-static method MyTimer::instance() should not be called statically in C:\eclipse-php\workspace\web\mypackage\classes\Timer.class.php on line 270

I'm using xampp, and modified php.ini to include this directive:

error_reporting = E_ALL & ~E_STRICT

and restart apache, but it makes no differences.

Any suggestions?

  • 写回答

1条回答 默认 最新

  • doushenjia8514 2014-10-27 20:28
    关注

    In my opinion, you should correct the error, but you can disable the error message also quite simple:

    ini_set('display_errors', '0'); # don't show any errors... error_reporting(E_ALL | E_STRICT); # ...but do log them in apache log

    set this code in your *.php file for example "index.php"

    more information: http://php.net/manual/en/function.error-reporting.php

    I hope it works fine for you

    Grezz Dave

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

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题