如何调整CodeIgniter的报错级别_PHP教程
程序员文章站
2022-06-07 20:52:29
...
不使用CI的时候,我们可以使用 error_reporting(E_ALL); error_reporting(0); 这类的代码来控制报错级别。当然也可以在类中使用这些语句,不过CI自己已经有控制报错级别的机制在里面了。
也许你不会经常打开index.php,但是修改就在这个文件里面:
/* *--------------------------------------------------------------- * APPLICATION ENVIRONMENT *--------------------------------------------------------------- * * You can load different configurations depending on your * current environment. Setting the environment also influences * things like logging and error reporting. * * This can be set to anything, but default usage is: * * development * testing * production * * NOTE: If you change these, also change the error_reporting() code below * */ define('ENVIRONMENT', 'development'); /* *--------------------------------------------------------------- * ERROR REPORTING *--------------------------------------------------------------- * * Different environments will require different levels of error reporting. * By default development will show errors but testing and live will hide them. */ if (defined('ENVIRONMENT')) { switch (ENVIRONMENT) { case 'development': error_reporting(E_ALL); break; case 'testing': case 'production': error_reporting(0); break; default: exit('The application environment is not set correctly.'); } }
ENVIRONMENT 就是来控制报错级别的,默认的有三个选项,development testing production,由上面的switch语句控制。代码已经很清楚了,可以根据自己的需求进行相应更改。
推荐阅读
-
解析php框架codeigniter中如何使用框架的session_PHP教程
-
如何调整CodeIgniter的报错级别_PHP教程
-
如何去除codeIgniter开发的网站url里面的index.php字符串_PHP教程
-
如何去掉CodeIgniter URL中的index.php_PHP教程
-
CodeIgniter2.2.0-在控制器里调用load失败报错的问题,thinkphp调用控制器_PHP教程
-
如何去除codeIgniter开发的网站url里面的index.php字符串_PHP教程
-
解析如何去掉CodeIgniter URL中的index.php_PHP教程
-
如何去掉CodeIgniter URL中的index.php_PHP教程
-
CodeIgniter2.2.0-在控制器里调用load失败报错的问题,thinkphp调用控制器_PHP教程
-
解析如何去掉CodeIgniter URL中的index.php_PHP教程