在PHP中,header()函数用于发送原始的HTTP头信息。它通常用于在服务器发送响应之前设置HTTP头。
header()函数的语法如下:
header(string $header, bool $replace = true, int $http_response_code = null): void
参数说明:
示例:
// 设置Content-Type头信息为text/html
header('Content-Type: text/html');
// 设置重定向头信息
header('Location: http://www.example.com');
// 设置HTTP响应代码为404
header('HTTP/1.1 404 Not Found');
注意事项:
更多关于header()函数的详细信息可以参考PHP官方文档:https://www.php.net/manual/en/function.header.php
下一篇:php strpos
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站