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

thinkphp模板使用有关问题

程序员文章站 2022-05-25 23:41:46
...
thinkphp模板使用问题
在thinkphp里面结合使用smarty模板,都已经配置好了,在IndexAction.class.php文件里面使用$this->display("login")没有问题,但是另外一个文件DefaultAction.class.php文件里面同样使用,则出现以下问题:
Fatal error: Call to a member function display() on a non-object in E:\php\AppServ\www\DLP\ThinkPHP\Lib\Think\Core\Action.class.php on line 103

其中Action.class.php那边的代码是:

protected function display($templateFile='',$charset='',$contentType='text/html')
{echo $templateFile;
if(false === $templateFile) {
$this->showTrace();
}else{
$this->view->display($templateFile,$charset,$contentType);
}
}

有没有出现过同样问题的大哥,给个帮助...

------解决方案--------------------
我也出现过,因为Action用了构造函数
function __construct()
{
//content
}

在TP中要用

function __construct()
{
parent::__construct;
}
thinkphp模板使用有关问题

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频