PHP error_log() ফাংশন
উদাহরণ
ত্রুটির বার্তা ওয়েব সার্ভার লগ এবং ইমেইল অ্যাকাউন্টে পাঠান
<?php // যদি ডাটাবেসে সংযুক্তির ত্রুটি হয়, তবে সার্ভার লগে ত্রুটির বার্তা পাঠান if (!mysqli_connect("localhost","bad_user","bad_password","my_db")) { error_log("Failed to connect to database!", 0); } // যদি FOO বর্জ্য হয়, তবে প্রশাসককে ইমেইল পাঠান if (!($foo = allocate_new_foo())) { error_log("Oh no! We are out of FOOs!", 1, "admin@example.com"); } ?>
Definition and Usage
The error_log() function sends error messages to the server error log, file, or remote target.
Syntax
error_log(message,type,destination,headers);
Parameter | Description |
---|---|
message | Required. Specifies the error message to be logged. |
type |
Optional. Specifies where the error should be sent. Possible values:
|
destination | Optional. Specifies the target of the error message. The value is determined by type The value of the parameter determines. |
headers |
Optional. Specifies additional headers, such as From, Cc, and Bcc. This information type uses the same built-in function as mail(). Only when message_type Used when set to 1. Should use CRLF (\r\n) to separate multiple headers. |
Technical Details
Return Value: | Returns TRUE if successful, FALSE otherwise. |
---|---|
PHP Version: | 4.0+ |
PHP Update Log: | PHP 5.2.7: Possible values: 4 Added to type Parameters. |