[Consolidate the PHP Basics] php debugging methods for white pages during development, consolidate php
Overview of this article: 1. Set the error reporting level to display the error 2. possible causes of White Pages
1. [set error reporting level and Display Error Reporting]During php development, the access address is also correct, but the page is not displayed, and the page is displayed as a white page. Therefore, you can identify that an error occurs and you cannot view it through firebug, you need to go to index. set the error reporting mechanism at the php entry file. in ini, the priority is set to higher, because it is closer to the back. Define ('Environment ', 'dev'); For the development ENVIRONMENT, define ('Environment', 'production '); For the production ENVIRONMENT, all errors are prohibited, remember to change it after the development is complete
2. [possible reasons for white pages]
In the future, if a white page is displayed, the error cannot be reported unless the display page is blank. Possible reasons:
A. No Display Error set in php. ini
B. Set error_reporting (0) in the page itself );
C. The @ symbol is used to suppress error prompting.
D. For a framework like CI, index. php In the system's entry file sets the production environment or development environment, and corresponding error reporting mechanisms are available for handling.
E. You can use firbug of Firefox to view errors. In "console" or "network", you can view "response" and "html". Here
In addition, when you want to develop ajax for interfaces such as json and xml, you can view the output content of the controller and model in these two fields.