更新时间:2022-02-18 08:52:42
该语法仅在PHP 5.3和更高版本中受支持.以前的版本不了解该语法,因此会出现解析错误(T_PAAMAYIM_NEKUDOTAYIM
指的是::
运算符).
That syntax is only supported in PHP 5.3 and later. Previous versions don't understand that syntax, hence your parse error (T_PAAMAYIM_NEKUDOTAYIM
refers to the ::
operator).
在以前的版本中,您可以尝试call_user_func()
,将包含类名及其方法名的数组传递给它:
In previous versions you can try call_user_func()
, passing it an array containing the class name and its method name:
$variable_class_name = 'foo';
call_user_func(array($variable_class_name, 'bar'));