自动跳转url的php代码是什么-PHP问题

资源魔 16 0

主动跳转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://www.example.com/');
exit;
?>

留意:

header执行前不克不及有任何输入

location以及:之间不克不及有空格

header后的php代码还会执行,以是需求留意应用exit;

保举:《php教程》

以上就是主动跳转url的php代码是甚么的具体内容,更多请存眷资源魔其它相干文章!

标签: php URL php教程 php故障解决 php使用问题

抱歉,评论功能暂时关闭!