wrz 11
Jak ustalić wersję php, mysql, apache i nie tylko?
Kiedyś musiałem wyświetlić nieco statystyk o aplikacji i środowisku w którym pracuje i napisałem taką klasę.
Może się komuś przyda.
[sourcecode lang="php"]
< ?php
class Version {
public static function getDateApplicationVersion() {
return "2008-09-11 11:10:00";
}
public static function getApplicationVersion(){
return "0.1.217";
}
public static function getPhpVersion(){
return phpversion();
}
public static function getZendFrameworkVersion(){
return Zend_Version::VERSION;
}
public static function getMysqlClientVersion(){
return mysql_get_client_info();
}
public static function getMysqlServerVersion(){
return @mysql_get_server_info();
}
public static function getApacheVersion(){
return apache_get_version();
}
public function __toString() {
$result = "PHP ".$this->getPhpVersion().”\n”.
„Zend Framework „.$this->getZendFrameworkVersion().”\n”.
„MySQL Client „.$this->getMysqlClientVersion().”\n”.
„MySQL Server „.$this->getMysqlServerVersion().”\n”.
„Apache „.$this->getApacheVersion().”\n”.
„Application „.$this->getApplicationVersion().” („.$this->getDateApplicationVersion().”)”.”\n”;
return $result;
}
}
?>
[/sourcecode]

