Home  >  Article  >  Backend Development  >  smarty出现未定义的函数

smarty出现未定义的函数

WBOY
WBOYOriginal
2016-06-20 12:26:29841browse


按照慕课网弄的,想把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(); ....

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