芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/yiisoft/yii2-debug/src/actions/db/ExplainAction.php
* @since 2.0.6 */ class ExplainAction extends Action { /** * @var DbPanel */ public $panel; /** * Runs the action. * * @param string $seq * @param string $tag * @return string * @throws HttpException * @throws \yii\db\Exception * @throws \yii\web\NotFoundHttpException if the view file cannot be found * @throws \yii\base\InvalidConfigException */ public function run($seq, $tag) { $this->controller->loadData($tag); $timings = $this->panel->calculateTimings(); if (!isset($timings[$seq])) { throw new HttpException(404, 'Log message not found.'); } $query = $timings[$seq]['info']; $results = $this->panel->getDb()->createCommand('EXPLAIN ' . $query)->queryAll(); $output[] = '
' . implode(array_map(function ($key) { return '
' . $key . '
'; }, array_keys($results[0]))) . '
'; foreach ($results as $result) { $output[] = '
' . implode(array_map(function ($value) { return '
' . (empty($value) ? 'NULL' : htmlspecialchars($value)) . '
'; }, $result)) . '
'; } $output[] = '
'; return implode($output); } }