ThinkPHP3.2.3调用全局控制器导致网页重复输出是什么原因?
程序员文章站
2024-02-13 13:48:16
...
(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();
}
}
?>
输出到模板时,网页出现了重复,就是
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();
}
}
?>
输出到模板时,网页出现了重复,就是
上一篇: linux下如何备份还原mysql数据库_MySQL
下一篇: MySQLODBC创建_MySQL