欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

PHP全局变量

程序员文章站 2024-01-21 22:58:28
...

php超级全局变量(以http://localhost/server.php?a=1&b=2为例

一、$GLOBALS

Array
(
    [_GET] => Array
        (
            [a] => 1
            [b] => 2
        )

    [_POST] => Array
        (
        )

    [_COOKIE] => Array
        (
            [XSRF-TOKEN] => eyJpdiI6IittYVwvYXdhTitJMUdNd080VVdVVTBBPT0iLCJ2YWx1ZSI6ImJybzVKWjkyOGNsUTlLXC94UDhxOGlTaGd0OVJHMzhBWXRvMXc5M2xMOW42a3pBVk1cLzFMa1oyXC80Nm1DV1BldFdjZ1h6R0YzK2MrWHh0eDN3bTQ1cDlRPT0iLCJtYWMiOiJjNDI1MjIzNmY5YjU0MGZlZDY5MTlkYjNiM2JmOTk5NjZlYjFhNmQ1YzI5ZjFlNzM2MGY2ZTFlNjNkM2VhODFiIn0=
            [laravel_session] => eyJpdiI6IjBKSzlEdDNFWlpwRXBOVjV0S0JoSkE9PSIsInZhbHVlIjoibnVOdCs5dHdXYmQ4UmhDSm1yS1FuS2ZJUmpTUFVIdFZXWkJcL3JUR3RodFhZWjR4Zm56akJyeWZjaWU1cTFLNkFiTWNnUHk1M0pMeWlWcXVCMGx6SkRRPT0iLCJtYWMiOiJmMTk2ZjY5ZDAxNDM5NWRlMmNmZmE5MGEyYmI1MWZmNjliZDkyMWUxYmU0MGVlZjNlYjJmZmYxNjkwZDhlZTZmIn0=
        )

    [_FILES] => Array
        (
        )

    [_SERVER] => Array
        (
            [PHP_EXTRA_CONFIGURE_ARGS] => --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi
            [HOSTNAME] => f98c3d9bbb04
            [PHP_INI_DIR] => /usr/local/etc/php
            [PORT] => 9000
            [HOME] => /var/www
            [PHP_LDFLAGS] => -Wl,-O1 -Wl,--hash-style=both -pie
            [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2
            [PHP_MD5] => 
            [PHP_VERSION] => 5.6.40
            [GPG_KEYS] => 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3
            [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2
            [PHP_ASC_URL] => https://secure.php.net/get/php-5.6.40.tar.xz.asc/from/this/mirror
            [PHP_URL] => https://secure.php.net/get/php-5.6.40.tar.xz/from/this/mirror
            [TERM] => xterm
            [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
            [PHPIZE_DEPS] => autoconf 		dpkg-dev 		file 		g++ 		gcc 		libc-dev 		make 		pkg-config 		re2c
            [PWD] => /var/www/html
            [PHP_SHA256] => 1369a51eee3995d7fbd1c5342e5cc917760e276d561595b6052b21ace2656d1c
            [USER] => www-data
            [FCGI_ROLE] => RESPONDER
            [SCRIPT_FILENAME] => /www/laravel//server.php
            [QUERY_STRING] => a=1&b=2
            [REQUEST_METHOD] => GET
            [CONTENT_TYPE] => 
            [CONTENT_LENGTH] => 
            [SCRIPT_NAME] => /server.php
            [REQUEST_URI] => /server.php?a=1&b=2
            [DOCUMENT_URI] => /server.php
            [DOCUMENT_ROOT] => /etc/nginx/html
            [SERVER_PROTOCOL] => HTTP/1.1
            [GATEWAY_INTERFACE] => CGI/1.1
            [SERVER_SOFTWARE] => nginx/1.8.1
            [REMOTE_ADDR] => 172.10.0.1
            [REMOTE_PORT] => 47146
            [SERVER_ADDR] => 172.10.0.2
            [SERVER_PORT] => 80
            [SERVER_NAME] => localhost
            [REDIRECT_STATUS] => 200
            [HTTP_HOST] => localhost
            [HTTP_CONNECTION] => keep-alive
            [HTTP_CACHE_CONTROL] => max-age=0
            [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
            [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36
            [HTTP_SEC_FETCH_USER] => ?1
            [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
            [HTTP_SEC_FETCH_SITE] => none
            [HTTP_SEC_FETCH_MODE] => navigate
            [HTTP_ACCEPT_ENCODING] => gzip, deflate, br
            [HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.9
            [HTTP_COOKIE] => XSRF-TOKEN=eyJpdiI6IittYVwvYXdhTitJMUdNd080VVdVVTBBPT0iLCJ2YWx1ZSI6ImJybzVKWjkyOGNsUTlLXC94UDhxOGlTaGd0OVJHMzhBWXRvMXc5M2xMOW42a3pBVk1cLzFMa1oyXC80Nm1DV1BldFdjZ1h6R0YzK2MrWHh0eDN3bTQ1cDlRPT0iLCJtYWMiOiJjNDI1MjIzNmY5YjU0MGZlZDY5MTlkYjNiM2JmOTk5NjZlYjFhNmQ1YzI5ZjFlNzM2MGY2ZTFlNjNkM2VhODFiIn0%3D; laravel_session=eyJpdiI6IjBKSzlEdDNFWlpwRXBOVjV0S0JoSkE9PSIsInZhbHVlIjoibnVOdCs5dHdXYmQ4UmhDSm1yS1FuS2ZJUmpTUFVIdFZXWkJcL3JUR3RodFhZWjR4Zm56akJyeWZjaWU1cTFLNkFiTWNnUHk1M0pMeWlWcXVCMGx6SkRRPT0iLCJtYWMiOiJmMTk2ZjY5ZDAxNDM5NWRlMmNmZmE5MGEyYmI1MWZmNjliZDkyMWUxYmU0MGVlZjNlYjJmZmYxNjkwZDhlZTZmIn0%3D
            [PHP_SELF] => /server.php
            [REQUEST_TIME_FLOAT] => 1580325134.7046
            [REQUEST_TIME] => 1580325134
        )

    [GLOBALS] => Array
 *RECURSION*
    [uri] => /server.php
)


二、$_SERVER

Array
(
    [PHP_EXTRA_CONFIGURE_ARGS] => --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --disable-cgi
    [HOSTNAME] => f98c3d9bbb04
    [PHP_INI_DIR] => /usr/local/etc/php
    [PORT] => 9000
    [HOME] => /var/www
    [PHP_LDFLAGS] => -Wl,-O1 -Wl,--hash-style=both -pie
    [PHP_CFLAGS] => -fstack-protector-strong -fpic -fpie -O2
    [PHP_MD5] => 
    [PHP_VERSION] => 5.6.40
    [GPG_KEYS] => 0BD78B5F97500D450838F95DFE857D9A90D90EC1 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3
    [PHP_CPPFLAGS] => -fstack-protector-strong -fpic -fpie -O2
    [PHP_ASC_URL] => https://secure.php.net/get/php-5.6.40.tar.xz.asc/from/this/mirror
    [PHP_URL] => https://secure.php.net/get/php-5.6.40.tar.xz/from/this/mirror
    [TERM] => xterm
    [PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    [PHPIZE_DEPS] => autoconf 		dpkg-dev 		file 		g++ 		gcc 		libc-dev 		make 		pkg-config 		re2c
    [PWD] => /var/www/html
    [PHP_SHA256] => 1369a51eee3995d7fbd1c5342e5cc917760e276d561595b6052b21ace2656d1c
    [USER] => www-data
    [FCGI_ROLE] => RESPONDER
    [SCRIPT_FILENAME] => /www/laravel//server.php
    [QUERY_STRING] => a=1&b=2
    [REQUEST_METHOD] => GET
    [CONTENT_TYPE] => 
    [CONTENT_LENGTH] => 
    [SCRIPT_NAME] => /server.php
    [REQUEST_URI] => /server.php?a=1&b=2
    [DOCUMENT_URI] => /server.php
    [DOCUMENT_ROOT] => /etc/nginx/html
    [SERVER_PROTOCOL] => HTTP/1.1
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_SOFTWARE] => nginx/1.8.1
    [REMOTE_ADDR] => 172.10.0.1
    [REMOTE_PORT] => 47146
    [SERVER_ADDR] => 172.10.0.2
    [SERVER_PORT] => 80
    [SERVER_NAME] => localhost
    [REDIRECT_STATUS] => 200
    [HTTP_HOST] => localhost
    [HTTP_CONNECTION] => keep-alive
    [HTTP_CACHE_CONTROL] => max-age=0
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36
    [HTTP_SEC_FETCH_USER] => ?1
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
    [HTTP_SEC_FETCH_SITE] => none
    [HTTP_SEC_FETCH_MODE] => navigate
    [HTTP_ACCEPT_ENCODING] => gzip, deflate, br
    [HTTP_ACCEPT_LANGUAGE] => zh-CN,zh;q=0.9
    [HTTP_COOKIE] => XSRF-TOKEN=eyJpdiI6IittYVwvYXdhTitJMUdNd080VVdVVTBBPT0iLCJ2YWx1ZSI6ImJybzVKWjkyOGNsUTlLXC94UDhxOGlTaGd0OVJHMzhBWXRvMXc5M2xMOW42a3pBVk1cLzFMa1oyXC80Nm1DV1BldFdjZ1h6R0YzK2MrWHh0eDN3bTQ1cDlRPT0iLCJtYWMiOiJjNDI1MjIzNmY5YjU0MGZlZDY5MTlkYjNiM2JmOTk5NjZlYjFhNmQ1YzI5ZjFlNzM2MGY2ZTFlNjNkM2VhODFiIn0%3D; laravel_session=eyJpdiI6IjBKSzlEdDNFWlpwRXBOVjV0S0JoSkE9PSIsInZhbHVlIjoibnVOdCs5dHdXYmQ4UmhDSm1yS1FuS2ZJUmpTUFVIdFZXWkJcL3JUR3RodFhZWjR4Zm56akJyeWZjaWU1cTFLNkFiTWNnUHk1M0pMeWlWcXVCMGx6SkRRPT0iLCJtYWMiOiJmMTk2ZjY5ZDAxNDM5NWRlMmNmZmE5MGEyYmI1MWZmNjliZDkyMWUxYmU0MGVlZjNlYjJmZmYxNjkwZDhlZTZmIn0%3D
    [PHP_SELF] => /server.php
    [REQUEST_TIME_FLOAT] => 1580325199.0307
    [REQUEST_TIME] => 1580325199
)


三、$_REQUEST

Array
(
    [a] => 1
    [b] => 2
)


四、$_POST

Array
(
)


五、$_GET

Array
(
    [a] => 1
    [b] => 2
)


六、$_FILES

Array
(
)


七、$_ENV

Array
(
)


八、$_COOKIE

Array
(
    [XSRF-TOKEN] => eyJpdiI6IndHMjZTQkl4K0dmWlpLUHlmZXJqeXc9PSIsInZhbHVlIjoicnVhNjN1YTJRZjZiYlBCZlMrcEZlQ1RnMXhGR1Y4Z1VyYU1CZVhHd2tvMnJ3aTJVVStXSUxORndyWUxobGExMXNzVkxwRVJtZlwvUllLeDF3UUZubFNRPT0iLCJtYWMiOiJiYTMwNzk3NTFkYWRiYTVjNTQ5NDEzZDYzYWVhNzBhZjEyNGZhNDBkYTlmMTVhN2ZmNDA1ODRlZmY3YzAwN2Q4In0=
    [laravel_session] => eyJpdiI6IlVROTNBT1BVOU5xZGVROERNaHUxWXc9PSIsInZhbHVlIjoiWkZ0NTBpeVJYdVVoNm9WbmR4ckJacXE0cW9JY01cL2JXZ1NhZWJienR2SDk3Q0FCT0NmM2FqYUNzT3NqRERnNHBOR0RGcGlmVXFoRUVxVm5HUHdPMzN3PT0iLCJtYWMiOiI4MTE1Zjc2ODRmMDAzMjY4NzI5ZjM3ODY3M2I4NmRiMDhhODUxOGRlZThmODdiOWExODE0ZDI5MjBhZDVlZDJkIn0=
)


九、$_SESSION

Array
(
)

 

相关标签: PHP PHP全局变量