Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial $_REQUEST为什么是空的?

$_REQUEST为什么是空的?

Jun 23, 2016 pm 02:16 PM

我的 php.ini 是这样设置的:

variables_order = "EGPCS"
request_order =

request_order 留空的话不是会使用 variables_order 的值吗?


回复讨论(解决方案)

不知道你怎么请求的,把你的请求过程描述一下。

 request_order =GP
不是默认的get和post,设置为空干嘛?

不知道你怎么请求的,把你的请求过程描述一下。

xxx.php?aaa=bbb

request_order 为空的时候 $_REQUEST 是空数组,
request_order = "GP" 的时候 $_REQUEST 才有内容。


不知道你怎么请求的,把你的请求过程描述一下。

xxx.php?aaa=bbb

request_order 为空的时候 $_REQUEST 是空数组,
request_order = "GP" 的时候 $_REQUEST 才有内容。


这就对了,看request_order 的解释,它设置的是$_REQUEST变量的设置和覆盖顺序。如果为空,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)变量了,自然就是空了



不知道你怎么请求的,把你的请求过程描述一下。

xxx.php?aaa=bbb

request_order 为空的时候 $_REQUEST 是空数组,
request_order = "GP" 的时候 $_REQUEST 才有内容。


这就对了,看request_order 的解释,它设置的是$_REQUEST变量的设置和覆盖顺序。如果为空,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)变量了,自然就是空了

那 php 的下面这句话是什么意思:

If this directive is not set, variables_order is used for $_REQUEST contents.
Copy after login
Copy after login
Copy after login


不是说留空就会使用 variables_order 的值吗?

还有 php.ini 里面说的 :

 626 ; This directive determines which super global data (G,P,C,E & S) should 627 ; be registered into the super global array REQUEST. If so, it also determines 628 ; the order in which that data is registered. The values for this directive are 629 ; specified in the same manner as the variables_order directive, EXCEPT one. 630 ; Leaving this value empty will cause PHP to use the value set in the 631 ; variables_order directive. It does not mean it will leave the super globals 632 ; array REQUEST empty. 633 ; Default Value: None 634 ; Development Value: "GP" 635 ; Production Value: "GP" 636 ; http://php.net/request-order 637 request_order = "GP"
Copy after login
Copy after login
Copy after login


难道我理解错了吗?我的英文水平是比较差。。。




不知道你怎么请求的,把你的请求过程描述一下。

xxx.php?aaa=bbb

request_order 为空的时候 $_REQUEST 是空数组,
request_order = "GP" 的时候 $_REQUEST 才有内容。


这就对了,看request_order 的解释,它设置的是$_REQUEST变量的设置和覆盖顺序。如果为空,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)变量了,自然就是空了

那 php 的下面这句话是什么意思:

If this directive is not set, variables_order is used for $_REQUEST contents.
Copy after login
Copy after login
Copy after login


不是说留空就会使用 variables_order 的值吗?

还有 php.ini 里面说的 :

 626 ; This directive determines which super global data (G,P,C,E & S) should 627 ; be registered into the super global array REQUEST. If so, it also determines 628 ; the order in which that data is registered. The values for this directive are 629 ; specified in the same manner as the variables_order directive, EXCEPT one. 630 ; Leaving this value empty will cause PHP to use the value set in the 631 ; variables_order directive. It does not mean it will leave the super globals 632 ; array REQUEST empty. 633 ; Default Value: None 634 ; Development Value: "GP" 635 ; Production Value: "GP" 636 ; http://php.net/request-order 637 request_order = "GP"
Copy after login
Copy after login
Copy after login


难道我理解错了吗?我的英文水平是比较差。。。


刚测试了。variables_order = "GP"
或者variables_order = "GPCS"
request_order =
的情况下确实如手册所说,request_order的值会使用variables_order的值。
php 5.2.17.

比较纳闷的是,记得changelog中request_order是在5.3中引入的,不知为何5.2的配置中也有该配置项





不知道你怎么请求的,把你的请求过程描述一下。

xxx.php?aaa=bbb

request_order 为空的时候 $_REQUEST 是空数组,
request_order = "GP" 的时候 $_REQUEST 才有内容。


这就对了,看request_order 的解释,它设置的是$_REQUEST变量的设置和覆盖顺序。如果为空,也就是$_REQUEST不包含P(Post),G(Get)和C(Cookie)变量了,自然就是空了

那 php 的下面这句话是什么意思:

If this directive is not set, variables_order is used for $_REQUEST contents.
Copy after login
Copy after login
Copy after login


不是说留空就会使用 variables_order 的值吗?

还有 php.ini 里面说的 :

 626 ; This directive determines which super global data (G,P,C,E & S) should 627 ; be registered into the super global array REQUEST. If so, it also determines 628 ; the order in which that data is registered. The values for this directive are 629 ; specified in the same manner as the variables_order directive, EXCEPT one. 630 ; Leaving this value empty will cause PHP to use the value set in the 631 ; variables_order directive. It does not mean it will leave the super globals 632 ; array REQUEST empty. 633 ; Default Value: None 634 ; Development Value: "GP" 635 ; Production Value: "GP" 636 ; http://php.net/request-order 637 request_order = "GP"
Copy after login
Copy after login
Copy after login


难道我理解错了吗?我的英文水平是比较差。。。


刚测试了。variables_order = "GP"
或者variables_order = "GPCS"
request_order = 
的情况下确实如手册所说,request_order的值会使用variables_order的值。
php 5.2.17.

比较纳闷的是,记得changelog中request_order是在5.3中引入的,不知为何5.2的配置中也有该配置项

但是我用外国的服务器 php 5.3.24 和本地的 php 5.4.4 测试的结果都是 request_order 留空并不会使用 variables_order 的值,而是直接把 $_REQUEST 留空了。

request_order 的确是 5.3 才引进的,会不会是你设置的 request_order 压根没起作用?5.3之前可能 $_REQUEST 直接就使用的 variables_order。

对于 $_REQUEST 的处理,php5.3 的早期版本是有问题的
至少在 php 5.3.6 中,如果没有传入数据,则 $_REQUEST 是未定义的,而不是仅仅为空
不太清楚这个问题是在哪个版本中被纠正的


It does not mean it will leave the super globals array REQUEST empty.

对于 $_REQUEST 的处理,php5.3 的早期版本是有问题的
至少在 php 5.3.6 中,如果没有传入数据,则 $_REQUEST 是未定义的,而不是仅仅为空
不太清楚这个问题是在哪个版本中被纠正的


It does not mean it will leave the super globals array REQUEST empty.

我测试的两个版本是空数组,不是未定义,
刚刚看了 ChangeLog 也没有提到这个,照这么说php文档和php.ini上面说的都是有错误的咯?

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

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-

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

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.

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

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' =>

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

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

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Customizing/Extending Frameworks: How to add custom functionality. Customizing/Extending Frameworks: How to add custom functionality. Mar 28, 2025 pm 05:12 PM

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

See all articles