【发布时间】:2012-12-25 07:23:53
【问题描述】:
我正在使用 Yii 框架和 HybridAuth 进行社交登录操作,我有 google 和 yahoo 工作正常,但我无法让 facebook 和 twitter 工作。
我需要一个 Https:// 域吗?还是只是要添加一些配置?
当我尝试使用 facebook 或 twitter 登录时,我收到了这个 PHP 警告:
include(DefaultController.php) [function.include]:无法打开流: 没有这样的文件或目录
错误出现在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]" )
)
)
)
),
【问题讨论】:
-
我今晚会试试这个,让你知道它是否适用于我的应用程序,我的应用程序适用于所有 4 的 oAuth,所以我可以让你知道它是插件还是只是你。
-
它对我来说很好用,你确定你的钥匙是正确的吗?
-
如果我没记错的话,这可能是由于 Facebook 返回了一个奇怪的字符串。你得到类似example.com/index.php#_#的东西吗?如果是这样,那么 #_# 就是原因。
标签: facebook twitter yii hybridauth