Use PHPConsole to share

Source: Internet
Author: User
Use PHPConsole to share
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:

 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:

 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": "success", "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, 4]}, "file": null, "line": null, "trace": null}]} Content-Length: 0
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.