可能重复:
PHP 中的“警告:标头已发送”
<?php
session_start();
$_SESSION['page'] = "test.php";
echo "Page to load in iframe = ". $_SESSION['page'];
setcookie('PagetoShow', $_SESSION);
if(isset($_COOKIE['PagetoShow']))
$Page = $_COOKIE['PagetoShow'];
echo "Page to load in iframe = ". $Page;
else
$Page="welcome.php"
?>
我猜这是一个语法错误,但我对 php 知之甚少或一无所知。怎么了?