quot;call to undefined functionquot; error when calling class method(“调用未定义的函数调用类方法时出错)
问题描述
这是错误致命错误:调用未定义的函数assign(
这是代码,正如你所看到的,我显然已经定义了函数,为什么它不起作用
this is the error Fatal error: Call to undefined function assign(
this is the code, as you can see i obviously have defined the function so why is it not working
推荐答案
您没有名为 assign()
的函数,但有一个具有此名称的方法.PHP 不是 Java,在 PHP 中你必须明确,如果你想调用一个函数
You dont have a function named assign()
, but a method with this name. PHP is not Java and in PHP you have to make clear, if you want to call a function
或方法
在您的情况下,对函数的调用驻留在另一个方法中.$this
总是指对象本身,其中存在一个方法.
In your case the call to the function resides inside another method. $this
always refers to the object, in which a method exists, itself.
这篇关于“调用未定义的函数"调用类方法时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!