在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Phalcon Debugbar一个无侵入的Phalcon Framework应用调试/分析工具条 功能特性
支持的数据收集器
快速开始composer
修改 index.php
修改权限控制代码下面的acl控制代码适用于 INVO: public function beforeDispatch(Event $event, Dispatcher $dispatcher) { $auth = $this->session->get('auth'); if (!$auth){ $role = 'Guests'; } else { $role = 'Users'; } $controller = $dispatcher->getControllerName(); $action = $dispatcher->getActionName(); /* Debugbar start */ $ns = $dispatcher->getNamespaceName(); if ($ns=='Snowair\Debugbar\Controllers') { return true; } /* Debugbar end */ $acl = $this->getAcl(); $allowed = $acl->isAllowed($role, $controller, $action); if ($allowed != Acl::ALLOW) { $dispatcher->forward(array( 'controller' => 'errors', 'action' => 'show401' )); $this->session->destroy(); return false; } } 数据持久化每次请求的调试数据都可以被保存下了, 供你进行系统分析.
关于 baseUri当心 baseUri 设置, 你的uri服务必须有正确的 baseUri设置. 然后:
技巧使用外部的配置文件, 以便于composer更新将包内 (new Snowair\Debugbar\ServiceProvider('your-debugbar-config-file-path'))->start(); 手动发送消息到调试条\PhalconDebug::startMeasure('start-1','how long'); // startMeasure($internal_sign_use_to_stop_measure, $label)\PhalconDebug::addMeasurePoint('start'); // measure the spent time from latest measurepoint to now.\PhalconDebug::addMessage('this is a message', 'label'); // add a message using a custom label.\PhalconDebug::info($var1,$var2, $var3, ...); // add many messages once a time. See PSR-3 for other methods name.(debug,notice,warning,error,...)\PhalconDebug::addMessageIfTrue('1 == "1"', 1=='1','custom_label'); // add message only when the second parameter is true\PhalconDebug::addMessageIfTrue('will not show', 1=='0');\PhalconDebug::addMessageIfFalse('1 != "0" ', 1=='0'); // add message only when the second parameter is false\PhalconDebug::addMessageIfNull('condition is null', Null ); // add message only when the second parameter is NULL\PhalconDebug::addMessageIfEmpty('condition is emtpy', $condtion ); // add message only when the second parameter is empty\PhalconDebug::addMessageIfNotEmpty('condition is not emtpy', $condtion=[1] ); // add message only when the second parameter is not empty\PhalconDebug::addException(new \Exception('oh , error'));\PhalconDebug::addMeasurePoint('stop');\PhalconDebug::stopMeasure('start-1'); // stopMeasure($internal_sign_use_to_stop_measure) Volt 模板函数addMessageaddMessageIfTrueaddMessageIfFalseaddMessageIfNulladdMessageIfEmptyaddMessageIfNotEmptyaddExceptionaddMeasurePointstartMeasurestopMeasuredebug/info/notice/warning/error/emergency/critical volt模板中发送消息示例{{ debug( var1, var2 )}}{{ info( var1, var2 )}}{{ addMessageIfTrue('$var === true', var ) }} 多模块应用相关我们认为以下习惯是良好的:
debugbar无需任何特殊设置即可支持符合以上习惯的多模块应用. 假如你的服务命名习惯与众不同,则需要手动将缓存或数据库服务绑定到debugbar中, 手动绑定示例代码如下: // service.php$di->set('my-db-2',function(...));$di->set('huan-cun',function(...));if ( $di->has('debugbar') ) { $debugbar = $di['debugbar']; $debugbar->attachDb('my-db-2'); $debugbar->attachCache('huan-cun');} 出现问题怎么办
截图 |
请发表评论