小编Dar*_*ius的帖子

$ _GET已填满,但$ _REQUEST为空

我最近在Windows 7中安装了nginx 1.4.4和PHP 5.5.8.我运行nginx.exe和php-cgi.exe来运行服务器并运行.当我在URL发送查询字符串,如果我print_r($_GET)的值是从查询字符串.但是如果我print_r($_REQUEST),那$_REQUEST只是一个空数组.我在stackoverflow中已经关注了一些其他问题,我发现只是检查request_order和variables_order.在php.ini中这是我在php.ini中对request_order和variables_order的当前配置:

; This directive determines which super global arrays are registered when PHP
; starts up. G,P,C,E & S are abbreviations for the following respective super
; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty
; paid for the registration of these arrays and because ENV is not as commonly
; used as the others, ENV is not recommended on productions servers. You …
Run Code Online (Sandbox Code Playgroud)

php nginx

5
推荐指数
1
解决办法
1881
查看次数

PHP调用函数与参数使用数组

function myFunc($x, $y) {
    echo "x : {$x}";
    echo "y : {$y}";
}
$params = array("y" => 1, "x" => 2);
Run Code Online (Sandbox Code Playgroud)

是否可以myFunc像使用call_user_func_array函数一样调用,但数组的键会自动在函数中设置正确的参数?是否有任何功能可以执行此操作或是否可以创建此功能?例如 :

call_func('myFunc', $params);
Run Code Online (Sandbox Code Playgroud)

结果就是这样

x : 2
y : 1
Run Code Online (Sandbox Code Playgroud)

谢谢.

php

4
推荐指数
1
解决办法
202
查看次数

标签 统计

php ×2

nginx ×1