Now to return reference to static function I return reference to closure (inside boot function). Closure just calls static function.
class AuthServiceProvider extends ServiceProvider
{
private static function createEloquentLdapProvider($app) {...}
public function boot()
{
Auth::extend('databaseLdapCredentials', function($app) {
return self::createDatabaseLdapProvider($app);
});
});
}
In C# I can return direct reference to static function by the name. I try to use function name in PHP also:
public function boot()
{
Auth::extend('databaseLdapCredentials', self::createDatabaseLdapProvider);
});
But it does not works. PHP thinks that self::createDatabaseLdapProvider
is static variable (not reference to static function).
So how I can return direct reference to static function in PHP and do not use closure, that is crutch in this case?
我认为您有一个错误,必须将$ this用作:
return this->createDatabaseLdapProvider($app);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.