qinjian1981 发表于 2006-08-02 14:05

php 页面跳转 header("Location:/");

annot modify header information - headers already sent by (output started at /home/wwwroot/class/wap_class.php:1)

知道header("Location:/"); 可以实现跳转,但是由于头部已经用了

header("content-type:text/vnd.wap.wml;charset=utf-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");


header("Location:/");一定要在其他header前,有什么办法可以清空前面的header,让我实现跳转。

tkmxxg 发表于 2006-08-02 14:13

.

我很少用header跳转,不方便,习惯用js的location

qinjian1981 发表于 2006-08-02 14:17

回复 2楼 tkmxxg 的帖子

问题是现在是在WML里 自然是无法实现的

qinjian1981 发表于 2006-08-02 14:19

传说中的斑竹也不进来指点指点 :D:P:P:P

HonestQiao 发表于 2006-08-02 14:29

headers_sent -- 检查标头是否已被发送以及在哪里被发送


说明
bool headers_sent ( ] )


如果 HTTP 标头尚未被发送出去的话,headers_sent() 将返回 FALSE,否则返回 TRUE。如果指定了可选参数 file 和 line, headers_sent() 将会把 PHP 的文件名以及从哪一行开始有输出放到 file 和 line 变量中。

一旦标头已经被发送,将不能再使用 header() 函数来发送其它的标头。使用此函数至少可以避免避免与 HTTP 标头有关的错误信息。另一个选择是使用输出缓存。



目录
flush -- 刷新输出缓冲
ob_clean --Clean (erase) the output buffer
ob_end_clean --Clean (erase) the output buffer and turn off output buffering
ob_end_flush --Flush (send) the output buffer and turn off output buffering
ob_flush --Flush (send) the output buffer
ob_get_clean --Get current buffer contents and delete current output buffer
ob_get_contents --Return the contents of the output buffer
ob_get_flush --Flush the output buffer, return it as a string and turn off output buffering
ob_get_length --Return the length of the output buffer
ob_get_level --Return the nesting level of the output buffering mechanism
ob_get_status --Get status of output buffers
ob_gzhandler --ob_start callback function to gzip output buffer
ob_implicit_flush --Turn implicit flush on/off
ob_list_handlers --List all output handlers in use
ob_start -- Turn on output buffering
output_add_rewrite_var --Add URL rewriter values
output_reset_rewrite_vars --Reset URL rewriter values

qinjian1981 发表于 2006-08-02 14:32

回复 5楼 HonestQiao 的帖子

还是你强 资料这么全 都快赶上手册了琢磨琢磨先 谢谢指点

[ 本帖最后由 qinjian1981 于 2006-8-2 14:36 编辑 ]

hjmsolar 发表于 2006-08-02 15:16

原帖由 qinjian1981 于 2006-8-2 14:32 发表
还是你强 资料这么全 都快赶上手册了琢磨琢磨先 谢谢指点

小乔的帖子向来这样。

HonestQiao 发表于 2006-08-02 15:44

我就是打开手册随时拷贝的。

yueliangdao0608 发表于 2006-08-02 16:27

如果header 前面有东西,headers_sent == 1 的话也是无法实现跳转的.还是location的好

mikespook 发表于 2006-08-02 16:48

在所有代码的最前面加入ob_start 调用~~

注意是最前面,连个空格都不要有~~
页: [1] 2
查看完整版本: php 页面跳转 header("Location:/");