Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out

PHP a Beginner's Guide _McGraw Hill Professional_

VIEWS: 25 PAGES: 1

									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);

								
To top