我正在使用一些方法来自动加载带有函数的辅助文件.我现在唯一的问题是如何调用该类中的变量.
因为我没有将它实例化为对象,所以$this无法工作.但是会是什么?
class some_helperclass {
var $some_variable = '007';
public static function some_func()
{
//return 'all ok';
if (self::some_variable !== FALSE)
{
return self::ip_adres;
}
}
Run Code Online (Sandbox Code Playgroud)
我现在可以在任何地方调用该功能spl_autoload_register().
some_helperclass:: some_func();
Run Code Online (Sandbox Code Playgroud)