Hi Reader's,
Welcome to FindNerd, today we are going to discuss how to use error_log() function in php ?
The error_log() function is used for sending an error message to a log, to a file, or to a mail account.
The error_log() function always returns TRUE on success or FALSE on failure.
syntax of error_log() function
error_log(message,type,destination,headers);
"message" is a required parameter
"type" is a optional parameter
"destination " is a optional parameter
"headers "is a optional parameter
you can see bellow example:
<?php
// Send a error message to the server log if error connecting to the database
if (!mysqli_connect("localhost","usrname","password","database")) {
//here call error_log()
error_log("Failed! unable to connect to database!", 0);
}
?>
0 Comment(s)