在yii框架中使用HybridAuth作为扩展时,代码中出现错误 - " undefined variable-user_profile"

时间:2015-06-08 08:35:00

标签: php yii

我使用HybridAuth扩展程序以登录为Facebook。 在Hybrid Auth中导致错误的代码如下:

try
{
            $path1 = Yii::getPathOfAlias('ext.HybridAuth');
            require_once ($path1 . '/hybridauth-' . HybridAuthIdentity::VERSION . '/hybridauth/Hybrid/Auth.php');
            $config   =  $path1 . '/hybridauth-' . HybridAuthIdentity::VERSION . '/hybridauth/config.php';

            // initialize Hybrid_Auth with a given file

            $hybridauth = new Hybrid_Auth( $config );

            // try to authenticate with the selected provider
            $adapter = $hybridauth->authenticate( $provider_name );

            // then grab the user profile

            $user_profile = $adapter->getUserProfile();
}
catch(Exception $e)
{
}

0 个答案:

没有答案