GET请求的参数粘贴在一起

时间:2017-03-07 15:42:18

标签: php nginx yii2

客户请求http://www.example.com并通过GET传递参数,最终请求为http://www.example.com/api/page?timestamp%3D1485404388%26sign%3De91a73150d87ebcb3ae00a26d85ce93b

正常情况

```
$_GET = [
     'timestamp' => 1485404388,
     'sign' => 'e91a73150d87ebcb3ae00a26d85ce93b'
]
```

异常情况

```
$_GET = [
     'timestamp=1485404388&sign=e91a73150d87ebcb3ae00a26d85ce93b' => ''
]
```

$ _ SERVER

```
'REQUEST_URI' => '/api/page?timestamp%3D1485404388%26sign%3De91a73150d87ebcb3ae00a26d85ce93b'
```

这种情况不会100%发生,通过查看日志我发现这个问题,我怀疑客户端是问题,但无法确定问题到底在哪里。

web.php

```
'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
        ],
```

nginx.conf

```
server
{
        listen 80;
        server_name  www.example.com;
        root   /www/example/web;
        index   index.php index.html index.htm;
        access_log /www/log/nginx/access_example.log;
        #error_log /www/log/nginx/error_example.log;

        location / {
            try_files $uri $uri/ /index.php$is_args$args;
        }

        location ~ \.php$ {
            root   /www/example/web;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            log_not_found  off;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
        error_page   500 502 503 504 /50x.html;
        location = /50x.html {
            root   /usr/local/nginx/html;
        }
}
```

0 个答案:

没有答案