Use the PHP console tool to share

Source: Internet
Author: User
  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
  • 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.