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

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

WBOY
WBOYOriginal
2016-06-23 13:12:20963browse

(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();
}
}
?>

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn