'; $html[] = ''; $html[] = ''; $html[] = ''; $html[] = ''; return $this->setResponse(new \Qii\Base\Response(array('format' => 'html', 'body' => join("\n", $html)))); return; $data = array(); $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id DESC LIMIT 1'); $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id ASC LIMIT 1'); $data['querySeconds'] = $this->db->querySeconds; return new \Qii\Base\Response(array('format' => 'json', 'body' => $data)); } /** * 设置controller中间件,此中间件将会在controller初始化之前使用 * @return array */ public function getMiddleware() { return parent::getMiddleware(); // TODO: Change the autogenerated stub } public function dispatchAction() { echo "

Dispatch start ". __CLASS__ ."

"; $this->dispatch('test', 'index'); echo "

Dispatch end ". __CLASS__ ."

"; } public function forwardAction() { echo "

This is start section " . __CLASS__ . " Forward

"; $this->setForward('test', 'index'); echo "

This is end section " . __CLASS__ . " Forward

"; } public function displayAction() { //可以从这里设置加载模板的路径 $this->view->setTemplateDir(__DIR__ . "/view/"); echo $this->view->fetch('index.tpl'); } }