Usage of $_GET, $_POST, $_REQUEST and $_SERVER in php
$_REQUEST: $_REQUEST — The HTTP Request variable contains an array of $_GET, $_POST, and $_COOKIE by default. Regardless of whether it comes from get or post, if you want to get the value of a certain key, just use $_REQUEST. However, the speed of $_REQUEST will be slightly slower than $_GET and $_POST. Get server-side information through $_SERVER $_SERVER is an array that contains headers, paths, script locations and other information. Earlier versions of PHP used the $HTTP_server_VARS array, which is now deprecated. The information of $_SERVER on different servers is not necessarily the same. Common usage is as follows:
The more common way to get QUERY_STRING is through $_SERVER['QUERY_STRING '] What you get is something like name=mike&age=30. To convert values in this format into variables, there is a method parse_str in PHP that can achieve this function. Official example:
pass the code in the local environment:
用带格式的数据打印出数组内容: array(31) { ["HTTP_ACCEPT"]=> string(3) "*/*" ["HTTP_ACCEPT_LANGUAGE"]=> string(5) "zh-CN" ["HTTP_USER_AGENT"]=> string(205) "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.2; Avant Browser)" ["HTTP_ACCEPT_ENCODING"]=> string(13) "gzip, deflate" ["HTTP_HOST"]=> string(14) "localhost:8080" ["HTTP_CONNECTION"]=> string(10) "Keep-Alive" ["HTTP_COOKIE"]=> string(154) "codehilite=IsPre=True&IsShowRowNumber=False&IsUseBR=False&Language=Csharp; iGHA2Cas=key=s8hoPBw6cWYHJ34NowHt%2f77gsEiQ9U9K0dDGPYjwLCFzQbqnNjlYMnUw9OOCF68u" ["PATH"]=> string(540) "C:Program Files (x86)ActiveState Komodo IDE 7;C:Program Files (x86)ActiveState Komodo Edit 7;E:appAdministratorproduct11.1.0client_1bin;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program Files (x86)Microsoft SQL Server100ToolsBinn;C:Program FilesMicrosoft SQL Server100ToolsBinn;C:Program FilesMicrosoft SQL Server100DTSBinn;C:Program FilesTortoiseSVNbin;C:Program Files (x86)Microsoft asp.netASP.NET Web Pagesv1.0;d:php-5.4.4-Win32-VC9-x86;" ["SystemRoot"]=> string(10) "C:Windows" ["COMSPEC"]=> string(27) "C:Windowssystem32cmd.exe" ["PATHEXT"]=> string(53) ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC" ["WINDIR"]=> string(10) "C:Windows" ["SERVER_SIGNATURE"]=> string(0) "" ["SERVER_SOFTWARE"]=> string(31) "Apache/2.2.22 (Win32) PHP/5.4.4" ["SERVER_NAME"]=> string(9) "localhost" ["SERVER_ADDR"]=> string(9) "127.0.0.1" ["SERVER_PORT"]=> string(4) "8080" ["REMOTE_ADDR"]=> string(9) "127.0.0.1" ["DOCUMENT_ROOT"]=> string(13) "D:/phpwwwroot" ["SERVER_ADMIN"]=> string(11) "dds@wwd.com" ["SCRIPT_FILENAME"]=> string(29) "D:/phpwwwroot/RecJP/test2.php" ["REMOTE_PORT"]=> string(5) "23827" ["GATEWAY_INTERFACE"]=> string(7) "CGI/1.1" ["SERVER_PROTOCOL"]=> string(8) "HTTP/1.1" ["REQUEST_METHOD"]=> string(3) "GET" ["QUERY_STRING"]=> string(0) "" ["REQUEST_URI"]=> string(16) "/RecJP/test2.php" ["SCRIPT_NAME"]=> string(16) "/RecJP/test2.php" ["PHP_SELF"]=> string(16) "/RecJP/test2.php" ["REQUEST_TIME_FLOAT"]=> float(1351577790572) ["REQUEST_TIME"]=> int(-1336907668) } |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio
