Similar to JS's console.log(); you can add it to the php code line and watch the console Log for debugging, so that it does not affect the normal program operation.
Similar to JS's console.log(); you can add it to the php code line and watch the console Log for debugging, so that it does not affect the normal program operation.
Reference an external php file chromePhp
Usage:
<code>include 'ChromePhp.php'; ChromePhp::log('Hello console!'); ChromePhp::log($_SERVER); ChromePhp::warn('something went wrong!');</code>
In this way, you can see the information in the chrome browser console. Haven't tried it on Firefox.
First of all, JavaScript can be parsed in the browser environment, but PHP cannot. It requires a parser such as Apache and php-cgi, so it is unrealistic for you to want PHP to run under the control of the browser.
When debugging, you can use functions such as echo, print_r, var_dump
to output the results to the page,
Of course you can also follow the xdebug debugging tool to support breakpoint debugging
Let me talk about the debugging methods I commonly use:
<code>file_put_contents('log.txt',var_export($_POST,true)); //这样不会中断程序的运行</code>
https://craig.is/writing/chrome-logger
Yes, monolog works with chromephp extension