Thinkphp template usage problems in thinkphp combined with the smarty template, all have been configured, in IndexAction. class. $ this-> display ("login") is used in the PHP file, but the DefaultAction is another file. class. if PHP files are used in the same way, the following problems may occur:
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
The code for Action. class. php is:
Protected function display ($ templateFile = '', $ charset ='', $ contentType = 'text/html ')
{Echo $ templateFile;
If (false ===$ templateFile ){
$ This-> showTrace ();
} Else {
$ This-> view-> display ($ templateFile, $ charset, $ contentType );
}
}
Have you ever had the same problem? give me some help...
Reply to discussion (solution)
It should be the ultaction. class. php file. check whether the class name and the inherited class name are correct.
It should not be an error in tp, but a problem with the display reference in your controller. check it carefully.
I have also seen it, because Action uses the constructor.
Function _ construct ()
{
// Content
}
Use in TP
Function _ construct ()
{
Parent: :__ construct;
}
I have also seen it, because Action uses the constructor.
Function _ construct ()
{
// Content
}
Use in TP
Function _ construct ()
{
Parent: :__ construct;
}
Positive solution