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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值