好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

自动跳转url的php代码是什么

自动跳转url的php代码是什么?

header()函数的主要功能是将HTTP协议标头(header)输出到浏览器。

语法:

void header ( string $string [, bool $replace = true [, int $http_response_code ]] )

可选参数replace指明是替换前一条类似标头还是添加一条相同类型的标头,默认为替换。

第二个可选参数http_response_code强制将HTTP相应代码设为指定值。 header函数中Location类型的标头是一种特殊的header调用,常用来实现页面跳转。注意:1.location和“:”号间不能有空格,否则不会跳转。

举例:

<html>
<?php
/* This will give an error. Note the output
 * above, which is before the header() call */
header('Location: http://HdhCmsTestexample测试数据/');
exit;
?>

注意:

header执行前不能有任何输出

location和:之间不能有空格

header后的php代码还会执行,所以需要注意使用exit;

推荐:《php教程》

以上就是自动跳转url的php代码是什么的详细内容,更多请关注Gxlcms其它相关文章!

查看更多关于自动跳转url的php代码是什么的详细内容...

  阅读:57次

上一篇: 怎么将txt改为php

下一篇:php增删改查封装