To illustrate:
In the Windows environment: Originally in the php4.3.0 running a normal program, in 4.3.1 why many error, the general tip is: notice:undefined varialbe: variable name.
For example, the following code:
Copy CodeThe code is as follows:
if (! $tmp _i) {
$tmp _i=10;
}
Running normally in 4.3.0, running in 4.3.1 will prompt notice:undefined varialbe:tmp_i
Under the question:
1. Where is the problem?
2. How should I modify this code?
3. Do not change the paragraph code, how to modify the settings in the php.ini so that the original program in the 4.3.0 in the 4.3.1 environment to operate normally? This error does not occur.
Workaround:
Add a sentence at the beginning of the program:
Error_reporting (E_all & ~e_notice); or error_reporting (e_all ^ e_notice);
Or
Modify PHP.ini
error_reporting = E_all & ~e_notice
About the error_reporting () function:
Error_reporting () Sets the error level for PHP and returns the current level.
; The error report is bitwise. Or add up the numbers to get the error report level you want.
; E_all-All errors and warnings
; E_error-Fatal Run-time error
; E_warning-run-time warning (non-fatal error)
; E_parse-Compile-time parse error
; E_notice-Runtime Reminders (these are often caused by bugs in your code,
, or it may be intentional behavior. (for example, an uninitialized variable is automatically initialized to a
The fact of an empty string uses an uninitialized variable)
; E_core_error-fatal error occurred during initialization of PHP startup
; E_core_warning-Warning (non-fatal error) occurred during initialization of PHP startup
; E_compile_error-Compile-time fatal error
; E_compile_warning-Compile-time warning (non-fatal error)
; E_user_error-error message generated by the user
; E_user_warning-user-generated warning message
; E_user_notice-user-generated reminder message
How to use:
error_reporting (0);//Disable error Reporting
Error_reporting (e_all ^ e_notice);//Display all error messages except E_notice
Error_reporting (E_all^e_warning^e_notice);//Displays all error messages except e_warning E_notice
Error_reporting (E_error | e_warning | E_parse);//Display run-time errors with error_reporting (e_all ^ e_notice); Error_reporting (E_all);//Show All errors
http://www.bkjia.com/PHPjc/323729.html www.bkjia.com true http://www.bkjia.com/PHPjc/323729.html techarticle Example: In the Windows environment: Originally in the php4.3.0 running a normal program, in 4.3.1 why many error, the general tip is: notice:undefined varialbe: variable name. For example, like ...