我对Superglobals有问题。
所有这些值(SERVER,POST,GET,SESSION,COOKIE)都是NULL 例如,转储$ _SERVER返回
array (size=42)
'MIBDIRS' => null
'MYSQL_HOME' => null
'OPENSSL_CONF' => null
'PHP_PEAR_SYSCONF_DIR' => null
'PHPRC' => null
'TMP' => null
'HTTP_HOST' => null
'HTTP_USER_AGENT' => null
'HTTP_ACCEPT' => null
'HTTP_ACCEPT_LANGUAGE' => null
'HTTP_ACCEPT_ENCODING' => null
'HTTP_REFERER' => null
'HTTP_COOKIE' => null
'HTTP_CONNECTION' => null
'HTTP_UPGRADE_INSECURE_REQUESTS' => null
'PATH' => null
'SystemRoot' => null
'COMSPEC' => null
'PATHEXT' => null
'WINDIR' => null
'SERVER_SIGNATURE' => null
'SERVER_SOFTWARE' => null
'SERVER_NAME' => null
'SERVER_ADDR' => null
'SERVER_PORT' => null
'REMOTE_ADDR' => null
'DOCUMENT_ROOT' => null
'REQUEST_SCHEME' => null
'CONTEXT_PREFIX' => null
'CONTEXT_DOCUMENT_ROOT' => null
'SERVER_ADMIN' => null
'SCRIPT_FILENAME' => null
'REMOTE_PORT' => null
'GATEWAY_INTERFACE' => null
'SERVER_PROTOCOL' => null
'REQUEST_METHOD' => null
'QUERY_STRING' => null
'REQUEST_URI' => null
'SCRIPT_NAME' => null
'PHP_SELF' => null
'REQUEST_TIME_FLOAT' => null
'REQUEST_TIME' => null
系统是Windows 7 + XAMPP + PHP 7.0.9和虚拟主机:
<VirtualHost *:80>
DocumentRoot "d:/php/test
<Directory />
Order allow,deny
Allow from all
Require all granted
</Directory>
ServerName http://test.com
UseCanonicalName Off
</VirtualHost>
并托管文件
127.0.0.1 test.com