1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 利用php-console和Chrome开发者工具实现PHP应用的printf

利用php-console和Chrome开发者工具实现PHP应用的printf

时间:2019-05-21 07:22:09

相关推荐

利用php-console和Chrome开发者工具实现PHP应用的printf

首先安装PHP-console这个Chrome扩展应用:

然后安装服务器端的库文件:/barbushin/php-console

用PHP的composer安装:

composer require php-console/php-console

如何在PHP代码里使用这些库文件:

首先用require引入__autoload.php:

获得PhpConsole的handler句柄,调用start方法后即可使用:

$handler = PhpConsole\Handler::getInstance();

$handler->start();

一些常用的打印方式:

带标签打印效果:

$handler->debug(‘called from handler debug’, ‘some.three.tags’);

直接打印:

PhpConsole\Connector::getInstance()->getDebugDispatcher()->dispatchDebug(‘called from debug dispatcher without tag s’);

还有一种缩略形式:

PhpConsole\Helper::register(); // required to register PC class in global namespace, must be called only once - 注册PC这个namespace

PC::debug(‘called from PC::debug()’, ‘db’);

PC::db(‘called from PC::__callStatic()’); // means “db” will be handled as debug tag

打印对象:

输出:

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。