request_order php,$_REQUEST为什么是空的?

我的 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.

不是说留空就会使用 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"

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

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

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.

不是说留空就会使用 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"

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

刚测试了。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.

不是说留空就会使用 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"

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

刚测试了。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上面说的都是有错误的咯?

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
给下面代码增加一个用户可以修改密码的功能 <?php require './common/init.php'; require './common/function.php'; session_start(); if($_SESSION['username']){ echo "下午好!{$_SESSION['username']}<br>"; echo "<a href='xiugai.php'>修改密码</a><br>"; } else { echo "<a href='login.php'>登录</a><br>"; echo "<a href='reg.php'>注册</a><br>"; } // 获取当前页码 $page = max(input('get', 'page', 'd'), 1); // 每页显示的条数 $size = 4; $sql = 'SELECT count(*) FROM `wish`'; if (!$res = mysqli_query($link, $sql)) { exit("SQL[$sql]执行失败:" . mysqli_error($link)); } $total = (int) mysqli_fetch_row($res)[0]; // 查询所有愿望 $sql = 'SELECT `id`,`name`,`content`,`time`,`color` FROM `wish` ORDER BY `id` DESC LIMIT ' . page_sql($page, $size); if (!$res = mysqli_query($link, $sql)) { exit("SQL[$sql]执行失败:" . mysqli_error($link)); } $data = mysqli_fetch_all($res, MYSQLI_ASSOC); mysqli_free_result($res); // 查询结果为时,自动返回第1页 if (empty($data) && $page > 1) { header('Location: ./index.php?page=1'); exit; } // 编辑或删除愿望 $id = max(input('get', 'id', 'd'), 0); $action = input('get', 'action', 's'); if ($id) { $password = input('post', 'password', 's'); $sql = 'SELECT `name`,`content`,`color`,`password` FROM `wish` WHERE `id`=' . $id; if (!$res = mysqli_query($link, $sql)) { exit("SQL[$sql]执行失败:" . mysqli_error($link) . $sql); } if (!$edit = mysqli_fetch_assoc($res)) { exit('该愿望不存在!'); } mysqli_free_result($res); $checked = isset($_POST['password']) || empty($edit['password']); if ($checked && $password !== $edit['password']) { $tips = '密码不正确!'; $checked = false; } // 删除愿望 if ($checked && $action == 'delete') { $sql = 'DELETE FROM `wish` WHERE `id`=' . $id; if (!mysqli_query($link, $sql)) { exit('SQL执行失败:' . mysqli_error($link)); } header('Location: ./index.php'); exit; } } mysqli_close($link); require './view/index.html';
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值