?应该没有问题吧测试文件如下
ttt.php
<?php
session_start();
$_SESSION['a']='This is a test.';
header("location:ttt2.php?run=$_SESSION[a]");
?>ttt2.php
<?php
echo $_GET['run'];
session_destroy();
?>楼主试一下,并不矛盾呀,可以共同使用.
ttt.php
<?php
session_start();
$_SESSION['a']='This is a test.';
header("location:ttt2.php?run=$_SESSION[a]");
?>ttt2.php
<?php
echo $_GET['run'];
session_destroy();
?>楼主试一下,并不矛盾呀,可以共同使用.
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=员工信息.xls");这样就不行
header就是输出了.
大家可以看一下session_start()向浏览器发送的内容:
---------- PHP ----------
Content-type: text/html
X-Powered-By: PHP/4.3.8
Set-Cookie: PHPSESSID=641fdf8789e44b57229a53f587df9923; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
输出完成 (耗时 0 秒) - 正常终止
而上面这些内容完全可以用header来代替,实际上session的功能一部分就是发送header,另外一部分在服务器存贮读取数据。
所以header和session_start的位置无所谓,只要....就行
目前session_start()遇到的很多问题都是不存在默认的目录/tmp,而打开了错误信息提示,这时候错误信息是在header信息之前发送的,所以会有两个错误,这是由错误导致的错误
ob_start()
ob_flush()