Home  >  Article  >  Backend Development  >  引见一个检查php版本适应性的pear:PHP_CompatInfo

引见一个检查php版本适应性的pear:PHP_CompatInfo

WBOY
WBOYOriginal
2016-06-13 11:00:18858browse

介绍一个检查php版本适应性的pear:PHP_CompatInfo
  今天发现老外居然有个pear扩展,是可以用来检查你的项目中是否符合某个PHP版本
或扩展的需要,它会告诉你你的项目中至少能运行起来的PHP版本,以及用了多少
PHP扩展等信息,项目地址帮助文档在
http://pear.php.net/manual/en/package.php.php-compatinfo.basic.php

用 pear install php_compatinfo 就可以了:

 
require_once 'PHP/CompatInfo.php';

$source = '/home/test/';

$driverType = 'xml';
$driverOptions = array();

$info = new PHP_CompatInfo($driverType, $driverOptions);
$info->parseDir($source);
?>
这里指定test目录下的所有文件为要检查的文件,输出格式为XML,php-compatinfo还支持CSV,HTML,TXT格式的输出格式,

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