我有一个 php 脚本,代码中的第一件事是session_start();
,但我一直收到这个错误
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/****/public_html/admincp/index.php:1) in /home/****/public_html/admincp/index.php on line 1
但该脚本在localhost
.
<?php session_start();?>
<?php
require 'global.php';
?>
<?php
//check if the user logged in
if(!isset($_SESSION['user_id']))
page_redirect('login.php'); // go to login.php.
?>