public function track($tag, $track = null) { if ($this->enable) { AsDebug::disable(); // 两者只能同时出现1种 $tag = strtolower(trim($tag)); if (!in_array($tag, $this->sysTags)) { $track = [$tag, $track]; $tag = self::TAG_INFO; } return $this->pipe($tag, $track); } AsDebug::dd($track, $tag); }
<div class="title"> A test page </div> </div> </div> <div class="tip"> <?php $url1 = $_app->pagePathing('view'); $url2 = $_app->pagePathing('view', $_GET); $url3 = $_app->pagePathing('view', ['A' => 1, 'b' => 2, time()]); ?> <p><a href="<?php echo $url1; ?> " target="_BLANK">平台登录测试</a></p> <p><a href="<?php echo $url2; ?> " target="_BLANK">平台登录测试</a></p> <p><a href="<?php echo $url3; ?> " target="_BLANK">平台登录测试</a></p> </div> <?php echo \Ws\Debug\AsDebug::instance()->jqAjaxBind(); ?> </body> </html>
<?php use Ws\Env; use Ws\Debug\AsDebug; use Ws\Mvc\Request; use Ws\Mvc\Cmd; $app = $this->me(); /*@var $app \Ws\Mvc\App */ $dir = $app->config()->get('app.dir'); // 注入类路径 Env::classLoader()->addPsr4('Default\\', $dir); // 绑定命令 Cmd::id('index')->bind(Request::GET, function ($app) { output('App: ' . $app->config()->get('app.id'), ''); output('Hello World!', 'text'); output($app->pagePathing('who.are.you', ['name' => 'a test']), 'url'); output($app->jsonPathing('who.love.you', ['tag' => 'php']), 'url'); })->bindTo($app); // 绑定 AsDebug 工具界面 AsDebug::cmdBind($app);
public static function cmdBind(App $app) { Cmd::group([['id' => 'asdebug', 'event' => Request::GET, 'closure' => function ($a) { $f = Request::get('f'); if ($f == 'json') { return AsDebug::instance()->cmdView($a, 'json'); } return AsDebug::instance()->cmdView($a, 'ui'); }]])->bindTo($app); }