为什么session无效??郁闷

wintergoes wintergoes 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
代码一:

<?

// page1.php

session_start();

echo 'Welcome to page #1';

$_SESSION['favcolor'] = 'green';
$_SESSION['animal'] = 'cat';

// Works if session cookie was accepted
echo '<br /><a href="session_get.php">page 2</a>';

// Or maybe pass along the session id, if needed
echo '<br /><a href="session_get.php?' . session_id() . '">page 2</a>';

?>



页面二:

<?
// page2.php

session_start();

echo 'Welcome to page #2<br />';

echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat

// You may want to use SID here, like we did in page1.php
echo '<br /><a href="page1.php">page 1</a>';
?>
...全文

相关推荐

评论 15
收藏 已收藏
分享
返回顶部
wintergoes
基础编程 21,889 成员 140,329 内容