The example in this article describes how PHP obtains server-side information. Share to everyone for your reference.
The implementation methods are as follows:
Copy Code code as follows:
/**
* Get System Information
*
* @return Array
*/
function GetSystemInfo ()
{
$systemInfo = Array ();
System
$systemInfo [' os '] = Php_os;
PHP version
$systemInfo [' phpversion '] = php_version;
Apache version
$systemInfo [' apacheversion '] = apache_get_version ();
Zend Version
$systemInfo [' zendversion '] = zend_version ();
GD related
if (function_exists (' Gd_info '))
{
$gdInfo = Gd_info ();
$systemInfo [' gdsupport '] = true;
$systemInfo [' gdversion '] = $gdInfo [' GD Version '];
}
Else
{
$systemInfo [' gdsupport '] = false;
$systemInfo [' gdversion '] = ';
}
Safe Mode
$systemInfo [' safemode '] = ini_get (' Safe_mode ');
Registering Global variables
$systemInfo [' registerglobals '] = ini_get (' register_globals ');
Turn on Magic Reference
$systemInfo [' magicquotes '] = (function_exists ("GET_MAGIC_QUOTES_GPC") && GET_MAGIC_QUOTES_GPC ());
Maximum upload file size
$systemInfo [' maxuploadfile '] = ini_get (' upload_max_filesize ');
Script run consumes maximum memory
$systemInfo [' memorylimit '] = Get_cfg_var ("Memory_limit")? Get_cfg_var ("Memory_limit"): '-';
return $systemInfo;
}
I hope this article will help you with your PHP program design.