我不断收到以下错误消息。我的本地主机 (xampp) 上不存在此问题。当文件在服务器上时,我遇到了这个问题。
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/plosta/public_html/bloom/Connections/bloom.php:1) in /home/plosta/public_html/bloom/signin.php on line 158
这发生在服务器上而不是本地主机上
<?php
//bloom.php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_bloom = "localhost";
$database_bloom = "datacenter";
$username_bloom = "root";
$password_bloom = "";
$bloom = mysql_pconnect($hostname_bloom, $username_bloom, $password_bloom) or trigger_error(mysql_error(),E_USER_ERROR);
?>
最佳答案
在页面顶部开始您的 session 。
<?php
//before that noting
session_start();
// Your code here
?>
关于php - session header 已发送问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25842669/