PHP a Beginner's Guide _McGraw Hill Professional_

Document Sample
PHP a Beginner's Guide _McGraw Hill Professional_ Powered By Docstoc
					326      PHP: A Beginner’s Guide




      Figure 10-3 Error output interspersed with page content



          // use custom handler
          set_error_handler('myHandler');

          // create an output buffer
          ob_start();

          // define a custom handler
          // which logs errors to the database
          // then generates an error page
          function myHandler($type, $msg, $file, $line, $context) {
            // log error to database
            $db = 'app.db';
            $pdo = new PDO("sqlite:$db");
            $msg = $pdo->quote($msg);
            $file = $pdo->quote($file);
            $line = $pdo->quote($line);

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:25
posted:8/15/2011
language:English
pages:1