tailieunhanh - Advanced PHP Programming- P3

Tham khảo tài liệu 'advanced php programming- p3', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 78 Chapter 3 Error Handling And these two settings set logging to go to a file or to syslog respectively error_log path to filename error_log syslog Logging provides an auditable trace of any errors that transpire on your diagnosing a problem I often place debugging lines around the area in question. In addition to the errors logged from system errors or via trigger_error you can manually generate an error log message with this error_log This is a user defined error Alternatively you can send an email message or manually specify the file. See the PHP manual for details. error_log logs the passed message regardless of the error_reporting level that is set error_log and error_reporting are two completely different entries to the error logging facilities. If you have only a single server you should log directly to a file. syslog logging is quite slow and if any amount of logging is generated on every script execution which is probably a bad idea in any case the logging overhead can be quite noticeable. If you are running multiple servers though syslog s centralized logging abilities provide a convenient way to consolidate logs in real-time from multiple machines in a single location for analysis and should avoid excessive logging if you plan on using syslog. Ignoring Errors PHP allows you to selectively suppress error reporting when you think it might occur with the if you want to open a file that may not exist and suppress any errors that arise you can use this fp @fopen file mode Because as we will discuss in just a minute PHP s error facilities do not provide any flow control capabilities you might want to simply suppress errors that you know will occur but don t care about. Consider a function that gets the contents of a file that might not exist content file_get_content sometimes_valid If the file does not exist you get an E_WARNING error. If you know that this is an expected possible outcome you should suppress this warning .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.