(1)全局控制器,路径"Apps/Common/Controller/BaseController.class.php"
namespace Common\Controller;
use Think\Controller;
class BaseController extends Controller {
public function _initialize(){
//调用数据库代码省略
$this -> assign(...);
$this -> display();
}
}
?>
(2)模块控制器,路径"Apps/Home/Common/Controller/HomeController.class.php"
namespace Home\Common\Controller;
use Common\Controller\BaseController;
class HomeController extends BaseController {
}
?>
(3)局部控制器,路径"Apps/Home/Controller/IndexController.class.php"
namespace Home\Controller;
use Home\Common\Controller\HomeController;
class IndexController extends HomeController {
public function index(){
$this -> display();
}
}
?>
输出到模板时,网页出现了重复,就是