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

演示session和cookie

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 19:38:13
Original
873 people have browsed it

无详细内容 无 ?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
 * 
 */
?>
Copy after login
<?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
 *
 */

?>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template