Use the PHP console tool to share

Source: Internet
Author: User

Use the PHP console tool to share

Http://www.open-open.com/lib/view/open1416193590414.html

Your rating :      Not bad Collect this experience

Read Catalogue

    • function Introduction
    • Demo
    • Principle Introduction
    • Appendix

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
Back to top 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:

?
1234567891011121314151617 <?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 as:

Back to the top of the 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.

Back to the top of the 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:

?
123456789101112131415161718192021 <?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 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:

?
123456789 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
From: http://blog.csdn.net/billfeller/article/details/40554625

Use the PHP console tool to share

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.