ArticleDirectory
- 2. disable a PHP error was encountered error prompt in codeigniter
The following two error messages are displayed:
A PHP error was encountered
Severity: Notice
Message: Trying to get property of non-Object
Filename: XXXXX
Line number: 67
A database error occurred
Error number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL Server version for the right syntax to use near ''at line 1
Select * From table_example where field =
Filename: XXXXX
Line number: 72
The correct solution is to check for errors and solve bugs. However, some unexpected bugs may leak some information, so it is necessary to disable such errors in the online environment.
However, according to the manual:
Note:By default, codeigniter will display all PHP errors.ProgramAt the end, you may want to change this situation. You will find this function at the top of the index. php file.Error_reporting ()You can use it to set errors. Even if you disable the Error Report, the error record will not stop when an error occurs.
Therefore, modifying PHP. ini cannot achieve the desired effect.
The solution is as follows:
1. Disable codeigniter
A database error occurred Error Message
Modify index. phpError_reporting:
Case 'production ': error_reporting(0); Break;
2. disable a PHP error was encountered error prompt in codeigniter
Modify database settings in config/database. php:
$ DB ['Default'] ['Db _ debug']=False;