Home > PHP Framework > ThinkPHP > body text

How to get request headers in thinkphp5

藏色散人
Release: 2022-12-05 10:48:37
Original
2387 people have browsed it

Thinkphp5 method of obtaining request headers: 1. Obtain all the information in the request header through the "$info=Request::instance()->header();" method; 2. Use "$accept= Request::instance()->header('accept');" method obtains the information in a request header.

How to get request headers in thinkphp5

The operating environment of this tutorial: Windows 7 system, ThinkPHP version 5, Dell G3 computer.

How to get request headers in thinkphp5?

ThinkPHP5 Obtain HTTP request header information

Use the header method in the Request object to obtain it.

Get all the information in the request header:

$info    =    Request::instance()->header();
Copy after login
获取某个请求头中的信息:
$accept   =    Request::instance()->header('accept');
Copy after login

The name of the HTTP request header information is not case-sensitive, and _ will be automatically converted to -

Recommended learning: "thinkPHP video tutorial

The above is the detailed content of How to get request headers in thinkphp5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template