Expert PHP 5 Tools phần 6

Điều này được thực hiện để đảm bảo rằng mã ông phát triển sẽ được tương thích với sự đóng góp của các nhà phát triển khác. Nó thậm chí còn có thể cho các nhà phát triển phải cập nhật bản sao của mình làm việc với những thay đổi của riêng mình nếu anh ta sử dụng nhiều hơn một bản sao làm việc, | Chapter 5 Fourth in addition to using this utility for spot-checking our code it should be able to handle exceptions as well. Hopefully the code you have been writing is taking advantage of exceptions. After all exceptions are the preferred way of handling condition out of our control in PHP and higher. Besides exceptions represent an easy way to collect and display a lot of information about the state of the executing program at the point in the logical flow where the exception occurred. Fifth since various core PHP functions and various modules generate errors instead of exceptions it would be a nice feature if we could include such errors in our debug output. Just like exceptions being thrown by native PHP methods or our code errors can represent unforeseen circumstances in the execution of our program. Sixth in addition to displaying information about currently executing line of code we would want to look at the sequence of functions and methods executed to arrive at the current line of code. This is called a backtrace and often consists of several methods or functions calling each other. Lastly in addition to the debug information associated with exceptions and errors we want to be able to have our utility output any additional variables objects or data structures we deem useful in diagnosing the problem. DebugException With that somewhat demanding list of requirements please take a look at the code in the following listing php class DebugException extends Exception const PLAIN 0 const HTML 1 public static sourceCodeSpan 10 public static outputFormat self HTML public static errorScope E_ERROR protected addedDebug array public function construct message code 0 make sure everything is assigned properly parent construct message code additional debug info if func_num_args 2 215 Download from Wow eBook Debugging this- addedDebug array_slice func_get_args 2 public function __destruct intentionally left blank to be called statically once to

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
154    81    1    22-05-2024
Đã 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.