Author: zhanhailiang Date: 2014-10-28
PHP console:https://github.com/barbushin/php-console#php-console-server-library
function Introduction
The PHP Console tool is similar to the firephp feature and provides the following features:
Handle PHP errors, dump variables, execute PHP code remotely in Google Chrome
Demo
First install the PHP console plugin in chrome:
Https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef
Next, the PHP console library is introduced into the PHP code, and the corresponding debug information is called out:
The following example index2.php:
Start (); $handler->debug (' Called from Handler Debug ', ' Some.three.tags '); $array = Array ( ' Test ' = 1, ' test2 ' = + 1, ' key ' = = = Array ( 1, 2, 3, 4, ), ); $handler-> ;d ebug ($array, ' Test.wiki.wade.zhan ');
Output debugging information to the console, such as:
Principle Introduction
The PHP console tool outputs debug information by outputting Debug information to the HTTP response header Php-console, and then the PHP console plug-in parses the response header Php-console string.
Appendix
PHP Console provides the ability to protect debug information through a password, as in the following example, setting a password on the server side:
SetPassword ($password); Call Debug from Phpconsole\handler$handler = Phpconsole\handler::getinstance (); $handler->start (); $handler Debug (' Called from Handler Debug ', ' Some.three.tags '); $array = Array ( ' Test ' = 1, ' test2 ' = + 1, ' key ' = = = Array ( 1, 2, 3, 4, ), ); $handler-> ;d ebug ($array, ' Test.wiki.wade.zhan ');
At this point you can see that only when the client enters the correct password:
The response header does not output the appropriate debug information at this time:
http/1.1 okserver:tengine/2.0.3date:tue, Oct 12:36:04 Gmtcontent-type:text/htmlconnection:keep-alivex-pow Ered-by:php/5.3.29php-console-postpone: {"Protocol": 5, "ispostponed": true, "id": "6957661441226218549514727634"} Php-console: {"Protocol": 5, "auth": {"PublicKey": " bf802ef9f6d61a5d4a720892a79bf8285d92c31c2a99be2931b504dc54eeb209 "," issuccess ": true}," Docroot ":" \/usr\/local\/ Wwwroot\/dokuwiki "," Sourcesbasepath ": null," Getbackdata ": null," isLocal ": false," Issslonlymode ": false," Isevalenabled ": false," messages ": [{" Type ":" Debug "," Tags ": [" some "," three "," tags "]," data ":" Called from handler Debug "," file ": null," line ": null," Trace ": null},{" type ":" Debug "," Tags ": [" Test "," wiki "," Wade "," Zhan "]," data ": {" Test ": 1, "Test2": 1, "key": [1,2,3,4]}, "file": null, "line": null, "Trace": null}]}content-length:0