I need to call a steady method of a class, but I only have one classname, not an example. I am doing this like this.
$ class = new "ModelName"; $ Items = $ square :: model () - & gt; FindAll (); It works on my computer, but when I go to the server, it throws a unexpected T_PAAMAYIM_NEKUDOTAYIM , so I think it's really The model expects one variable instead of a method. PS: If it helps, then it is the Yii framework, so if there is another way to find () function, it's okay for me.
Thanks in advance
That's because your server is before 5.3.0 Runs a version of PHP, which does not have this syntax supported.
From the documentation on:
According to PHP 5.3.0, it is possible to refer to the square using a variable. The variable value can not be a keyword (such as yourself, parent, and static).
In any case, you can always use it:
$ class = "model name"; // "New" in your example was a typo, right? $ Item = call_user_func (array ($ square, 'model')) - & gt; FindAll ();
Comments
Post a Comment