php is not like aspx and jsp. The development environment of aspx and jsp is stuck, but they have a console of Visual Studio and Eclipse to check the changes of variables at any time. If php is developed using Notepad, Notepad or Dreamweaver, etc., There is no console for you to observe the flow of variables. In some background pages, such as Ajax response pages, such as database method pages, for example, if you want to see whether a certain variable is requested, there is no page for you to echo at all.
At this time, there is no need to install any tools at all. Use PHP statements to operate files and print the variables or data to be debugged to a txt or an html. We can open or refresh without listening to observe the variables, which is enough for debugging. .
If you want to debug the $content variable, write like this:
$fp = fopen('./a.txt', 'a+b'); fwrite($fp, "content=".$content); fclose($fp);
Then, write the "content=".$content variable, this string into the file a.txt. Of course, you can output it however you like. Of course, this output will not be carried back to the carriage. You can also Add a carriage return after the variable. See the result picture below for details.
Close this pointer afterwards.
If the thing you want to debug is a $content array, then write like this:
$fp = fopen('./a.txt', 'a+b'); fwrite($fp, print_r($content, true)); fclose($fp);
The following is part of my debugging results of a certain program. After the 2 and 4 variables
is an array:
The above has introduced how [php] allows Notepad to become a console for you to control variables, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.