PHP错误颜色

I would like to have all php notices yellow, warnings orange and fatal errors red. I'm thinking of a method that could be implemented in any class and, in case of error, would change outputs color. Maybe wrap around <span style="class:color">$error</span> or similar.

Any ideas/suggestions/pointers how to achieve that?

If you haven't already, try Xdebug first. Learn to love that Xdebug orange and save yourself a ton of grief implementing a custom color-coded error handler.

Have a look at: set_error_handler()

$errno will contain one of the error-constants (E_ERROR, E_WARNING), that way you can decide on what to do.

You can use set_error_handler() to register your own error handler and, based on the type of error that is triggered, add the coloring you would like.