저는 PHP와 세션에 익숙하지 않습니다. 저는 이전에 그들과 함께 일해 본 적이 없으며, 하위 도메인에서 AJAX로 작업하는 데 몇 가지 문제가 있습니다.PHP : session_cookie over subdomains?
나는 http://www.example.com/whatever에 그리고 난과 함께 쿠키를 설정하고있어 : 다음 페이지의 특정 부분을 다시로드 jQuery를 (load()
)를 사용하고
session_set_cookie_params(0, '/', '.example.com');
session_start();
if(!isset($_SESSION['password'])) {
$_SESSION['password'] = $_POST['password'];
}
var_dump(ini_get_all('session')); //seems like it doesn't save the cookie???
. 로딩 중입니다. somefile.phphttp://subdomain.example.com/subdomain/somefile.php 이 somefile.php 안에 세션 정보를 가져오고 싶습니다. 나는 사용하고있다
var_dump(ini_get_all('session')); //can't find the cookie!??
if(isset($_SESSION['password'])) {
$user_pass = $_SESSION['password'];
echo "Password: " . $user_pass . "<br>";
} else {
print "can't find cookie!";
}
그러나 나는 정보를 얻을 수 없다! 내가 뭘 잘못했는지 알기나 해? 내가 놓친 게 있니?
세션 쿠키가 제대로 설정하고 이후의 요청에 반환되는 경우 확인 했습니까? – Gumbo