无涯教程-PHP - header函数

99 阅读1分钟

header - 语法

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

用于发送一行HTTP头部。

Sr.No 参数 & Description
1

string

它包含标题字符串。

2

replace

它的replace参数指示标题是否应替换以前的相似标题。

3

HTTP_RESPONSE_CODE

Http响应码是具体的值,表示响应成功与否。

header - 返回值

没有返回值

header - 示例

<?php
   header("Location: https://www.learnfk.com/");

exit; ?>

上面的示例重定向到浏览器到learnfk.com网站

参考链接

www.learnfk.com/php/php-fun…