Parse the method in php for obtaining system information
- 2020-06-19 10:01:37
- OfStack
$root = getenv (' DOCUMENT_ROOT '); //// server document root directory
$port = getenv (' SERVER_PORT '); //// server port
$file = getenv (' SCRIPT_NAME '); //// currently executing file
$ua = getenv (' HTTP_USER_AGENT '); / / / / the user UA
$method = getenv (' REQUEST_METHOD '); //// request method
$protocol = getenv (' SERVER_PROTOCOL '); //// Transport protocol
getmypid(), //// returns the process number ID for the current PHP process, which does not require input parameters.
get_current_user(), //// returns the owner name of the current program, and this function does not require input parameters.
$port = getenv (' SERVER_PORT '); //// server port
$file = getenv (' SCRIPT_NAME '); //// currently executing file
$ua = getenv (' HTTP_USER_AGENT '); / / / / the user UA
$method = getenv (' REQUEST_METHOD '); //// request method
$protocol = getenv (' SERVER_PROTOCOL '); //// Transport protocol
getmypid(), //// returns the process number ID for the current PHP process, which does not require input parameters.
get_current_user(), //// returns the owner name of the current program, and this function does not require input parameters.
Get system type and version number: php_uname() ( Ex. : Windows NT COMPUTER 5.1 build 2600)
Get only the system type: php_uname('s') ( Or: PHP_OS Example: Windows NT)
Get the system version number only: php_uname('r') ( Ex. : 5.1)
To obtain PHP Operation mode: php_sapi_name() (PHP run mode : apache2handler)
Get the previous process user name: Get_Current_User()
To obtain PHP Version: PHP_VERSION
To obtain Zend Version: Zend_Version()
To obtain PHP Installation path: DEFAULT_INCLUDE_PATH
Get the absolute path of the current file: __FILE__
To obtain Http In the request Host Value: $_SERVER["HTTP_HOST"] ( The return value is domain name or IP)
Get server IP : GetHostByName($_SERVER['SERVER_NAME'])
The server that accepts the request IP : $_SERVER["SERVER_ADDR"] ( Sometimes it is not available, it is recommended to use: GetHostByName($_SERVER['SERVER_NAME']))
Get client IP : $_SERVER['REMOTE_ADDR']
Get server interpretation engine: $_SERVER['SERVER_SOFTWARE']
Get server CPU Quantity: $_SERVER['PROCESSOR_IDENTIFIER']
Get the server system directory: $_SERVER['SystemRoot']
Get server domain name: $_SERVER['SERVER_NAME'] ( Recommended use: $_SERVER["HTTP_HOST"])
Obtain user domain name: $_SERVER['USERDOMAIN']
Get server language: $_SERVER['HTTP_ACCEPT_LANGUAGE']
Get server Web Port: $_SERVER['SERVER_PORT']