我正在使用 Yii 框架和 HybridAuth 进行社交登录操作,我有 google 和 yahoo 工作正常,但我不能让 facebook 和 twitter 工作。
我需要一个 Https://域名吗?还是只是要添加一些配置?
当我尝试使用 facebook 或 twitter 登录时,我收到此 PHP 警告:
include(DefaultController.php) [function.include]: failed to open stream: No such file or directory
错误出现在 vendors\yii_1.1.10\YiiBase.php(418):
{
407 foreach(self::$_includePaths as $path)
408 {
409 $classFile=$path.DIRECTORY_SEPARATOR.$className.'.php';
410 if(is_file($classFile))
411 {
412 include($classFile);
413 break;
414 }
415 }
416 }
417 else
418 include($className.'.php');
419 }
420 else // class name with namespace in PHP 5.3
421 {
422 $namespace=str_replace('\\','.',ltrim($className,'\\'));
423 if(($path=self::getPathOfAlias($namespace))!==false)
424 include($path.'.php');
425 else
426 return false;
427 }
428 return class_exists($className,false) || interface_exists($className,false);
429 }
430 return true;
这是我的主要配置文件
'modules'=>array('admin',
'hybridauth' => array(
'baseUrl' => 'http://'. $_SERVER['SERVER_NAME'] . '/hybridauth',
'withYiiUser' => false, // Set to true if using yii-user
"providers" => array (
"yahoo" => array (
"enabled" => true
),
"google" => array (
"enabled" => true,
"keys" => array ( "id" => "[private]", "secret" => "[private]" ),
"scope" => ""
),
"facebook" => array (
"enabled" => true,
"keys" => array ( "id" => "[private]", "secret" => "[private]" ),
"scope" => "email,publish_stream",
"display" => ""
),
"twitter" => array (
"enabled" => true,
"keys" => array ( "key" => "[private]", "secret" => "[private]" )
)
)
)
),
最佳答案
尝试导入 hybridauth 文件:
config/main.php
'import'=>array(
...
// for hybridauth
'application.modules.hybridauth.controllers.*',
...
),
关于facebook - 在 Hybridauth 中为 Yii 框架配置 Facebook,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14265848/