我在我的网站上有3种类型的表单,并且一直工作得很好,直到有一天。我不知道发生了什么,但我得到了会话错误;我的意思是,我得到一个错误,每当我有一个PHP脚本,包括里面的会话标签,例如这是我的开始在<html>
标签:为什么我使用相同的代码获取会话错误?
<?php
// Make the page validate
ini_set('session.use_trans_sid', '0');
// Create a random string, leaving out 'o' to avoid confusion with '0'
$char = strtoupper(substr(str_shuffle('abcdefghjkmnpqrstuvwxyz'), 0, 4));
// Concatenate the random string onto the random numbers
// The font 'Anorexia' doesn't have a character for '8', so the numbers will only go up to 7
// '0' is left out to avoid confusion with 'O'
$str = rand(1, 7) . rand(1, 7) . $char;
// Begin the session
session_start();
// Set the session contents
$_SESSION['captcha_id'] = $str;
?>
当我测试这个在我的网站,我得到:
警告:在session_start():不能发送会话缓存限制器 - 中/ home4 /域已经发送了头(输出开始/home4/domain/public_html/adres/contact.php:2)/的public_html/ADRES /第16行的contact.php
Exa可能是session_start()
所在的部分?相同的代码结构之前工作 - 发生了什么?
错误告诉你'output [was]开始于/ home4/domain/public_html/adres/contact.php'。我建议通过一些能够显示原始字节的东西来运行你的文件,例如* nix工具'xxd(1)';你可能在头部有不可打印的字符的文件。 – TML 2014-10-03 21:45:56