PEAR

  简介:pear是php扩展与应用库(the php extension and application repository)的缩写。它是一个php扩展及应用的一个代码仓库。

  编码规范:参考(http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2008/1224/271.html )

  用法
  1.下载并安装模块;
  2.php.ini配置

include_path = ".;c:\php\includes;D:\wamp\bin\php\php5.3.3\PEAR\pear"

  3.代码

require_once "Cache/Lite.php";//引入模块库主文件
        $options=array(
                'cacheDir'=>'D:/tmp/',//这里是Cache的路径,最好用绝对路径,我们的例子中将会有说明
                'lifeTime'=>30,//缓存的失效时间,秒为单位
                'pearErrorMode'=>CACHE_LITE_ERROR_DIE//报错模式
        );
        $cache = new Cache_Lite($options);
        $a = $cache->save("dedecms","php","cms");
        var_dump($cache->get("php","cms"));

 

  常用模块:

  参考(http://www.php100.com/html/webkaifa/PHP/PHPyingyong/2008/1224/266.html)

以前安装过了Pear,是使用了go-pear.php方法安装的.最新想在家里的机器上安装上pear,并且使用一个自带的go-pear.phar包的方法安装.这里出现的一个问题就是提示一个1236行错误

D:\PHPEV_7\php5.3>php pear/go-pear.phar phar “D:\PHPEV_7\php5.3\PEAR\go-pear.phar” does not have a signaturePHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar “phar://go-pear.phar/index.php” in D:\PHPEV_7\php5.3\PEAR\go-pear.phar on line 1236

google的结果就是,这里附带的pear包缺少了一个signature,需要安装的包必须附带有sha1或者md5的签名才可以安装,这里有两种解决方法,其根本目的就是在运行的时候取消对phar的signature的检查.
1.修改php.ini

phar.require_hash = 0

2.在命令行运行的时候加入

phar.require_hash = 0

posted @ 2013-11-04 18:16  洒洒  阅读(1093)  评论(0编辑  收藏  举报