Przeglądaj źródła

框架初始化

Zhu Jinhui 7 lat temu
rodzic
commit
b1cd9525d5

+ 3 - 0
private/Controller/index.php

@@ -14,6 +14,7 @@ class index extends \Qii\Base\Controller
         
         return new \Qii\Base\Response(array('format' => 'json', 'body' => $data));
     }
+    
     public function dispatchAction()
     {
         $this->dispatch('test', 'index');
@@ -26,6 +27,8 @@ class index extends \Qii\Base\Controller
 
     public function displayAction()
     {
+        //可以从这里设置加载模板的路径
+        $this->view->setTemplateDir(__DIR__ . "/view/");
         $this->view->display('index.tpl');
     }
 }

+ 1 - 0
private/Controller/view/index.tpl

@@ -0,0 +1 @@
+This is tpl from controller dir