我试图在 wordpress 会话旁边创建一个新会话并在 wordpress 登录后设置一个属性
function login_function() {
global $current_user;
$email = (string) $current_user->user_email;
$xxx = session_name("xxx");
session_set_cookie_params(0, '/', '.اینستا.com');
session_start();
$_SESSION['email'] = $email;
echo '<script language="javascript">';
echo 'alert('.$_SESSION['email'].')';
echo '</script>';
}
add_action('wp_login', 'login_function');
它显示为空且无法成功重定向
更新
echo 'alert('.$email.')';
发生同样的事情,警报为空并且无法成功重定向