$ _SERVER ['REQUEST_SCHEME']是否可靠? [英] Is $_SERVER['REQUEST_SCHEME'] reliable?
问题描述
最近,我正在寻找一种方法来正确确定协议,根据该协议,向服务器提供url请求.
I recently was seeking a way to properly determine protocol, under which url request was supplied to the server.
我通过 parse_url()
和
I watched through parse_url()
and though $_SERVER
superglobal variable, and found this:
<?php
header('Content-Type: text/plain');
print_r($_SERVER);
输出:
[REQUEST_SCHEME] => http
[REQUEST_SCHEME] => http
但是,我在 php.net 上找不到它,或者谷歌.不过,我能够找到 此 问题. 问题#1:如果没有记录$_SERVER['REQUEST_SCHEME']
,那么它可能不可靠,还是可以信任的?
However, I was unable to find it on php.net or Google. Though, I was able to find this question. Q#1: If $_SERVER['REQUEST_SCHEME']
wasn't documented, then it is probably unreliable, or it can be trusted?
我正在Windows下使用VC9 PHP 5.4.14 TS
进行开发.但是我的作品在ubuntu下. Q#2:这个属性在ubuntu linux下也可以使用吗?
I'am using VC9 PHP 5.4.14 TS
under windows for development. But my production is under ubuntu. Q#2: Is this property also availible under ubuntu linux too?
推荐答案
很难证明它是可靠的,但是很容易证明它不可靠(如果我能提供一个它不可靠的情况)工作).而且我可以证明它是不可靠的,因为它不适用于 IIS 7.0 + PHP 5.3
It is hard to prove that it is reliable, but it is easy to prove that it is not reliable (if only I could provide a case which it does not work). And I can prove that it is unreliable because it does not work with IIS 7.0 + PHP 5.3
这篇关于$ _SERVER ['REQUEST_SCHEME']是否可靠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!