Summary: PHP error log, can be saved locally, can also be saved in the remote directory, below we save in the local as an example.
PHP Error Log Save
related functions: error_log ($mes, $mes _type, $destination)
where $mes_type= 3 indicates that the error log is appended to the file instead of overwriting the original file
Case 1 :
<?phpdate_default_timezone_set ("asia/chongqing"), function Age_error ($erroro, $erromes) {echo <strong> Error level </strong>:<font color= ' red ' > '. $erroro. ' </font><br> "; echo "<strong> error message </strong>:". $erromes; $time =date ("y-m-d g:i:s"); Save the error message \ r \ n Enter a carriage return to the file $info = "error level:" $erroro. " "." Error message: ". $erromes." Time: "$time." \ r \ n "; Error_log ($info, 3, "error_log.txt"); } set_error_handler ("Age_error", e_user_notice);//The error level is usually: e_user_warning,e_user_notice,e_user_error $age = 700; echo "Age:" $age. " <br> "; if ($age >100) {trigger_error ("too old, greater than"); exit ();} ?>
Run code, refresh multiple times, and the results are as follows:
age:700
Error Level : 1024x768
error Message : Too old, greater than
Open Error_log.txt
You can see the following effects:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/69/wKiom1dAVGaykaVqAABksmBwjrg776.png "title=" capture. PNG "alt=" Wkiom1davgaykavqaabksmbwjrg776.png "/>
This article is from "Uncle Wei Xiaobao" blog, please be sure to keep this source http://darmi.blog.51cto.com/11607923/1775738
PHP error Log Save