PHP Console tool share, phpconsole
Author: zhanhailiang Date:
PHP Console: https://github.com/barbushin/php-console#php-console-server-library
Features
The PHP Console tool and FirePHP have similar functions., Provides the following features:
Handle PHP errors, dump variables, execute PHP code remotely in Google Chrome
Demo
First install the PHP Console plug-in Chrome:
Https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef
Next, introduce the PHP Console library in the PHP code, and then call and output the corresponding debugging information:
For example, index2.php:
<?php require_once(__DIR__ . '/../src/PhpConsole/__autoload.php'); // 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->debug($array, 'test.wiki.wade.zhan');
Output debugging information to the console, such:
Principles
The PHP Console tool outputs debugging information to the http Response Header PHP-Console, and then the PHP Console Plug-In analyzes the Response Header PHP-Console string to output the corresponding debugging information.
Appendix
The PHP Console provides a password to protect debugging information. For example, set a password on the server:
<?php require_once(__DIR__ . '/../src/PhpConsole/__autoload.php'); $password = 'test';$connector = PhpConsole\Connector::getInstance();$connector->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->debug($array, 'test.wiki.wade.zhan');
At this point, we can see that only when the client enters the correct password:
At this time, the response header will output the corresponding debugging information:
HTTP/1.1 200 OKServer: Tengine/2.0.3Date: Tue, 28 Oct 2014 12:36:04 GMTContent-Type: text/htmlConnection: keep-aliveX-Powered-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
How to have a php console in windows-Technical Q &
I found php.exe when I got it. It was useless. Which one installed wamp? Can I run php under command line in windows? How did you configure it?
Does jquery have a debugging tool, just like in PHP, which of the following lines can be prompted if an error occurs?
You can use the firefox browser with an error console. You can prompt that the js Code is incorrect. If a js Code error or warning occurs on each test page, you can see it on the error console.