왕 기초 테스트

왕 기초 테스트입니다.
전 세계에 배포하는 솔루션이라고 했를때
어떤 값이 나올까요?
 
$_SESSION["USERID"] = "bengi";
.................
.................
.................
$USERID = "sir";
.................
.................
echo $_SESSION["USERID"];
 
 
 
|

댓글 4개

너무 왕 기초라
설문 참여 않하시나 봅니다.....ㅎㅎㅎ
아무생각없이 일단 sir을 누르고 봤습니다 ㅋㅋ
혹시 register_globals 와 관련이 있을까 해서 테스트 해봤는데 전혀 상관이 없네요 ㅋㅋ
[ 해답 ]

위치 : http://php.net/manual/en/reserved.variables.session.php

Please note that if you have register_globals to On, global variables associated to $_SESSION variables are references, so this may lead to some weird situations.

<?php

session_start();

$_SESSION['test'] = 42;
$test = 43;
echo $_SESSION['test'];

?>

Load the page, OK it displays 42, reload the page... it displays 43.

The solution is to do this after each time you do a session_start() :

<?php

if (ini_get('register_globals'))
{
foreach ($_SESSION as $key=>$value)
{
if (isset($GLOBALS[$key]))
unset($GLOBALS[$key]);
}
}

?>


---------------------------------------------------

미국에서 구매한 솔루션이라고 하기에
믿었건만....

정답은 JMoon 님....^-^
댓글을 작성하시려면 로그인이 필요합니다.

자유게시판

+
제목 글쓴이 날짜 조회
12년 전 조회 2,219
12년 전 조회 1,094
12년 전 조회 1,212
12년 전 조회 1,314
12년 전 조회 1,197
12년 전 조회 9,035
12년 전 조회 1,563
12년 전 조회 1,141
12년 전 조회 1,177
12년 전 조회 1,545
12년 전 조회 2,000
12년 전 조회 1,825
12년 전 조회 1,079
12년 전 조회 2,788
12년 전 조회 1,160
12년 전 조회 1,107
12년 전 조회 1,255
12년 전 조회 8,607
12년 전 조회 2,292
12년 전 조회 1,393
12년 전 조회 1,267
12년 전 조회 3,082
12년 전 조회 1,267
12년 전 조회 1,566
12년 전 조회 4,471
12년 전 조회 1,211
12년 전 조회 1,165
12년 전 조회 1,116
12년 전 조회 1,424
12년 전 조회 1,885