欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

ThinkPHP3.2.3调用全局控制器导致网页重复输出是什么原因?

程序员文章站 2022-06-15 21:47:10
...
(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();
}
}
?>

输出到模板时,网页出现了重复,就是