请看详细的错误程序和输出结果 <html> <? echo "testing ... "; session_start(); ?> </html>输出为 testing ... Warning: Cannot send session cookie - headers already sent by (output started at F:php2000test.php:2) in F:php2000test.php on line 4Warning: Cannot send session cache limiter - headers already sent (output started at F:php2000test.php:2) in F:php2000test.php on line 4分析: 主要原因,php.ini里有关于session 的定义,默认是使用 cookie [session] session.use_cookies = 1 ; whether to use cookies这句表明使用 cookies 存储session 而 cookies的设置必须在正式 htm 之前,也就是只能在 header 里面才行,所以造成这个错误的发生我们修改程序为 <? echo "testing ... "; session_start(); ?> 同样错误,因为 echo 已经输出了我们修改程序为 <? $i=1; session_start(); ?> 运行正确表明在session_start的前面可以有计算语句,但是不能有输出语句我尝试过修改 session.use_cookies = 0 ; whether to use cookies 但是没有成功,希望知道答案的朋友通知我,如何去掉cookie方式的 session
Warning: Unable to create '/stuphoto/01_on.gif': No such file or directory in /home/jgxy/public_html/cgi/appaddp.php on line 7Warning: Cannot add header information - headers already sent by (output started at /home/jgxy/public_html/cgi/appaddp.php:7) in /home/jgxy/public_html/cgi/appaddp.php on line 8 第一个warning是因为'/stuphoto/这个目录不存在 写入失败! 第二个warning是因为前面抛出了一个warning 已经把head信息给了客户端 所以header失败 抛出第二个warning
header("Location:appadd.php");
这个转向的appadd.php页面中哎你用
echo "<meta http-equiv=refresh conent=1;url=http://*.*>";
算了。
!你的系统的绝对根目录下有???
错了
header();是不能在此之前发送任何信息的!!
http://www.hooday.com/faq/56.shtml
下面是原文;
关于使用 session_start 出现的 headers already sent错误的解释
--------------------------------------------------------------------------------
请看详细的错误程序和输出结果
<html>
<?
echo "testing ... ";
session_start();
?>
</html>输出为
testing ...
Warning: Cannot send session cookie - headers already sent by (output started at F:php2000test.php:2) in F:php2000test.php on line 4Warning: Cannot send session cache limiter - headers already sent (output started at F:php2000test.php:2) in F:php2000test.php on line 4分析:
主要原因,php.ini里有关于session 的定义,默认是使用 cookie
[session]
session.use_cookies = 1 ; whether to use cookies这句表明使用 cookies 存储session 而 cookies的设置必须在正式 htm 之前,也就是只能在 header 里面才行,所以造成这个错误的发生我们修改程序为
<?
echo "testing ... ";
session_start();
?>
同样错误,因为 echo 已经输出了我们修改程序为
<?
$i=1;
session_start();
?>
运行正确表明在session_start的前面可以有计算语句,但是不能有输出语句我尝试过修改
session.use_cookies = 0 ; whether to use cookies
但是没有成功,希望知道答案的朋友通知我,如何去掉cookie方式的 session
第一个warning是因为'/stuphoto/这个目录不存在 写入失败!
第二个warning是因为前面抛出了一个warning 已经把head信息给了客户端 所以header失败 抛出第二个warning
避免方式是:
1。上传路径:
站点虚拟根:
$virtual_root = "/stuphoto/";
物理路径:
$physical_root = $_SERVER['DOCUMENT_ROOT'].$virtual_root;copy($_FILES['impicture']['tmp_name'],$physical_root.$_FILES['impicture']['name']);