gpt4 book ai didi

php - fatal error : Class 'Hybrid_Logger' not found in/hybridauth/Hybrid/Endpoint. php 第 165 行

转载 作者:行者123 更新时间:2023-12-01 21:47:49 26 4
gpt4 key购买 nike

我正在准备将 HyBridAuth 作为插件部署在我的网站中。我的功能看起来像这样。

function authenticatewith( $provider ){
ini_set('display_errors','on');

//includes

$config = dirname(__FILE__) . '/hybridauth-2.1.2/hybridauth/config.php';
require_once( "hybridauth-2.1.2/hybridauth/Hybrid/Auth.php" );

$provider_name = $provider;

//$config = $this->getconfig($id);
try{
// 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 ){
echo "Error: please try again!";
echo "Original error message: " . $e->getMessage();
}

echo "USer Details: ";
var_dump($user_profile);

}

当我尝试访问任何提供程序时遇到 fatal error 。

Fatal error: Class 'Hybrid_Logger' not found in hybridauth/Hybrid/Endpoint.php on line 165

我在堆栈中没有得到这个问题的链接,但我会在这里提出这个问题。

感谢和问候

最佳答案

在执行其他操作之前,请确保您正在使用 session_start()。

由于如果 session 已经启动,使用 session_start() 会抛出 E_NOTICE 级别的错误,因此更好的方法是:

if(session_id() == '') {
session_start();
}

请记住,如果用户的浏览器未启用 cookie,则由于 PHP 设置 session.use_cookies 的默认值,您将遇到 HybridAuth 问题

session.use_cookies = 1 //PHP uses cookies by default

我正在开发的一个项目的测试版用户报告说看到了这个错误 - 并且很长一段时间我无法复制这个错误。经过长时间的调试,结果发现这是一个特定于用户的浏览器配置错误(cookie 被禁用)。不确定它是否能解决您的问题,但值得一提的是错误:

Fatal error: Class 'Hybrid_Logger' not found in hybridauth/Hybrid/Endpoint.php 

也可能是由于浏览器特定设置(例如禁用 cookie)引起的。

引用文献:

http://php.net/manual/en/function.session-start.php

http://php.net/manual/en/session.security.php

关于php - fatal error : Class 'Hybrid_Logger' not found in/hybridauth/Hybrid/Endpoint. php 第 165 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26795216/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com