Home >Backend Development >PHP Tutorial > 预约义变量 PHP

预约义变量 PHP

WBOY
WBOYOriginal
2016-06-13 13:16:281043browse

预定义变量 PHP

小记:

?

$_SERVER: http://www.php.net/manual/zh/reserved.variables.server.php

$_ENV: http://www.php.net/manual/zh/reserved.variables.environment.php

?

$_POST, $_GET里的数据都可以通过$_REQUEST得到,但$_REQUEST会比$_GET和$_POST慢。

$_FILE: 文件上传,http://www.php.net/manual/zh/features.file-upload.post-method.php 只在POST上传文件时才有数据。参照帮助页面的Example #3

$_COOKIE和$_SESSION用于会话控制。

?

另外,如果要自定义$_SERVER中的值,只需要在fastcgi_params添加一些常用的变量(多用于集群)。添加下面这些代码:

fastcgi_param? DB4_USER?? root;
fastcgi_param? DB4_PASS? ? "";
fastcgi_param? DB4_HOST?? localhost;
fastcgi_param? DB4_PORT?? 3306;
fastcgi_param? DB4_NAME?? test;

?

那么在$_SERVER["DB4_USER"]得到当前环境变量值root。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn