在我的应用程序URL中,我无法访问完整的URL示例:www.examle.com/test.php?id=3
通常我们可以得到如下值
$_GET['id'] = 3;
但在我的应用程序中,它不工作
因此,我打印$_SERVER的值。
[UNIQUE_ID] => YjrrveqpEeuu1FcU9vhhAAAAAAQ
[HTTP_X_FORWARDED_FOR] => 122.179.51.122, 64.252.100.210
[HTTP_X_FORWARDED_PROTO] => https
[HTTP_X_FORWARDED_PORT] => 443
[HTTP_HOST] => www.example.com
[HTTP_X_AMZN_TRACE_ID] => Root=1-623aebbd-28269a532256d99658b3dceb
[HTTP_USER_AGENT] => Amazon CloudFront
[HTTP_X_AMZ_CF_ID] => vQJWRlfiiA4QWME7ScshqZmO4aR1nPvGjUKluZOfRK478BtFcIJ30w==
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
[HTTP_VIA] => 2.0 3d029316ef030de84eb214747e947124.cloudfront.net (CloudFront)
[HTTP_ACCEPT_ENCODING] => gzip, deflate, br
[HTTP_UPGRADE_INSECURE_REQUESTS] => 1
[HTTP_SEC_FETCH_SITE] => none
[HTTP_SEC_FETCH_MODE] => navigate
[HTTP_SEC_FETCH_USER] => ?1
[HTTP_SEC_FETCH_DEST] => document
[HTTP_SEC_CH_UA] => " Not A;Brand";v="99", "Chromium";v="99", "Google Chrome";v="99"
[HTTP_SEC_CH_UA_MOBILE] => ?0
[HTTP_SEC_CH_UA_PLATFORM] => "Windows"
[PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache
[SERVER_NAME] => www.example.com
[SERVER_ADDR] => 172.31.67.87
[SERVER_PORT] => 80
[REMOTE_ADDR] => 172.31.23.129
[DOCUMENT_ROOT] => /var/www/html
[REQUEST_SCHEME] => http
[CONTEXT_PREFIX] =>
[CONTEXT_DOCUMENT_ROOT] => /var/www/html
[SERVER_ADMIN] => root@localhost
[SCRIPT_FILENAME] => /var/www/html/demo.php
[REMOTE_PORT] => 33234
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /demo.php
[SCRIPT_NAME] => /demo.php
[PHP_SELF] => /demo.php
[REQUEST_TIME_FLOAT] => 1648028605.456
[REQUEST_TIME] => 1648028605
此处[查询字符串] =〉也为空
但在另一个演示服务器中
[QUERY_STRING] => id=3
我可以知道为什么主服务器不显示query_string吗?
Application Version - CI 3
PHP version - 5.6
我也在使用AWS Centos服务器
1条答案
按热度按时间xiozqbni1#
可以启用查询字符串。
实现这一点的一个简单方法是解析服务器查询字符串,如下所示。
这将给您留下一个充满数据的非常不安全的数组,因此您应该使用CI的安全类使其更加安全;非常喜欢;