关闭CI的php notice

使用CI的时候,如果一个变量没有值,CI就会提示 Undefined,用PHP的开发的人都知道,定义PHP的变量是不需要初始化任何的值,看这notice真烦人,决定关掉它,开始先搜 A PHP Error was encountered 只在error目录中找到error_php.php,不是想要的结果,这文件只是模板,再搜文件名:error_php,在system/libraies中的Exceptions中发现

  1.     /**
  2.      * Native PHP error handler
  3.      *
  4.      * @access  private
  5.      * @param   string  the error severity
  6.      * @param   string  the error string
  7.      * @param   string  the error filepath
  8.      * @param   string  the error line number
  9.      * @return  string
  10.      */
  11.     function show_php_error($severity$message$filepath$line)
  12.     {   
  13.         $severity = ( ! isset($this->levels[$severity])) ? $severity : $this->levels[$severity];
  14.     
  15.         $filepath = str_replace("//", "/", $filepath);
  16.         
  17.         // For safety reasons we do not show the full file path
  18.         if (FALSE !== strpos($filepath'/'))
  19.         {
  20.             $x = explode('/'$filepath);
  21.             $filepath = $x[count($x)-2].'/'.end($x);
  22.         }
  23.         
  24.         if (ob_get_level() > $this->ob_level + 1)
  25.         {
  26.             ob_end_flush(); 
  27.         }
  28.         ob_start();
  29.         include(APPPATH.'errors/error_php'.EXT); 
  30.         $buffer = ob_get_contents();
  31.         ob_end_clean();
  32.         echo $buffer;
  33.     }

找到include(APPPATH.'errors/error_php'.EXT); 这行,把它注释掉,就OK了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值