Use the Javascript console of the browser to debug the PHP program
Source: Internet
Author: User
Nowadays, more and more browsers have developed this tool or Javascript console, we can easily display the variables or array values in PHP code. PHP is a server-side scripting language used to develop dynamic web applications. Compared with JAVA, the absence of a good server-side debugging tool is one of its limitations. Generally, we add echo, var_dump, and other statements in PHP code to display the values of variables and arrays in the browser for debugging.
Nowadays, more and more browsers have developed this tool or Javascript console. with these tools, we can easily display variables or array values in PHP code. Here is an example. The PHP code in this example has four tracking levels: info, warn, log, and error. developers can use the browser console to display error variables and array values.
Copy the following code to the php file and save it as WebConsole. php.
The code is as follows:
Class WebConsole {
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.