当前位置:Gxlcms > PHP教程 > smarty出现未定义的函数

smarty出现未定义的函数

时间:2021-07-01 10:21:17 帮助过:36人阅读

按照慕课网弄的,想把smarty模版放入mvc模式中,但是出现了这个错误就不知道咋办了


Fatal error: Call to undefined function newtestController() in D:\maizi\mvc\function.php(6) : eval()'d code on line 1


回复讨论(解决方案)

把$name与$method打印出来
然后看看$name.Controller这个文件和class是否存在,

例如$name是abc,$method是test
则在controller中找有没有class abcController,然后看看这个class下有没有test() 方法

错误说 newtestController() 函数不存在

你书写的是 eval('$obj=new'.$name.Controller(); ....
明显少了个空格,应该写作
eval('$obj=new '.$name.Controller(); ....

人气教程排行