有人可以帮我猜出这段代码吗?这只是一个片段,我想我包含了我的问题所需的所有代码。实际上这段代码来自hybridAuth。我的问题是,最后一行的“user_id”来自哪里?我想知道,因为 $_SESSION["user"] 给出了“id”的值。而且我想制作另一个 $_SESSION[" "] 我可以在其中放置数据库中 email-add 的值(该 user_id 的“id”存在的相同位置)
// create an instance for Hybridauth with the configuration file path as parameter
$hybridauth = new Hybrid_Auth( $hybridauth_config );
// try to authenticate the selected $provider
$adapter = $hybridauth->authenticate( $provider );
// grab the user profile
$user_profile = $adapter->getUserProfile();
// load user and authentication models, we will need them...
$authentication = $this->loadModel( "authentication" );
$user = $this->loadModel( "user" );
# 1 - check if user already have authenticated using this provider before
$authentication_info = $authentication->find_by_provider_uid( $provider, $user_profile->identifier );
# 2 - if authentication exists in the database, then we set the user as connected and redirect him to his profile page
if( $authentication_info ){
// 2.1 - store user_id in session
$_SESSION["user"] = $authentication_info["user_id"];