Home >php教程 >php手册 >演示session和cookie

演示session和cookie

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 19:38:13874browse

无详细内容 无 ?phpsession_start();$_SESSION['name']="陌陌";$_SESSION['age']=19;echo 'session:br/';print_r($_SESSION);echo 'br/cookie:br/';print_r($_COOKIE);echo 'br/这是session.php';/* *第一次输出: session: Array ( [name] = 陌陌 [age] = 19

<?php
session_start();
$_SESSION['name']="陌陌";
$_SESSION['age']=19;

echo 'session:<br/>';
print_r($_SESSION);

echo '<br/>cookie:<br/>';
print_r($_COOKIE);

echo '<br/>这是session.php';


/*
 *第一次输出:
    session:
    Array ( [name] => 陌陌 [age] => 19 ) 
    cookie:
    Array ( ) 
            这是session.php 
 * 
 * 之后输出:
    session:
    Array ( [name] => 陌陌 [age] => 19 ) 
    cookie:
    Array ( [PHPSESSID] => hpl14nebl5ch91c3vefvq018h3 ) 
             这是session.php
 * 
 */
?>
<?php
session_start();

echo 'session:<br/>';
print_r($_SESSION); 

echo '<br/>cookie:<br/>';
print_r($_COOKIE);

echo '<br/>这是testsession.php';


/*
 *输出:
    session:
    Array ( [name] => 陌陌 [age] => 19 ) 
    cookie:
    Array ( [PHPSESSID] => hpl14nebl5ch91c3vefvq018h3 ) 
             这是testsession.php
 *
 */

?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn