Prev | Current Page 109 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


CHAPTER 3 ?–  STARTING THE TSHIRTSHOP PROJECT 50
?– Tip If you don't remember or don't know what a PHP error message looks like, try adding the following
line in your index.php file:
require_once 'inexistent_file.php';
Load the web site in your favorite browser, and notice the error message you get. If you do this test, make
sure to remove the problematic line afterward!
In the context of a live web application, errors can happen unexpectedly for various reasons,
such as software failures (operating system or database server crashes, viruses, and so
on) and hardware failures. It??™s important to be able to log these errors and eventually inform
the web site administrator (perhaps by sending an e-mail message), so the error can be taken
care of as fast as possible.
For these reasons, we??™ll start establishing an efficient error-handling and reporting strategy.
You??™ll create a class named ErrorHandler that will manage the error handling. In this class,
you??™ll create a static, user-defined error-handler method named Handler(), which will get executed
anytime a PHP error happens during runtime. In PHP, you define a custom error handler
using the set_error_handler() function.
?– Caution As you??™ll see, the second parameter of set_error_handler() is used to specify the error types
that the specified handler function should handle. However, this second parameter is supported only since
PHP 5.


Pages:
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
Apartamenty Świnoujście noclegi hel Lokaty jednodniowe projekty domków letniskowych męskie skarpetki rowerowe