• 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:phpincludes;D:wampinphpphp5.3.3PEARpear"

      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_7php5.3>php pear/go-pear.phar phar “D:PHPEV_7php5.3PEARgo-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_7php5.3PEARgo-pear.phar on line 1236

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

    phar.require_hash = 0

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

    phar.require_hash = 0

  • 相关阅读:
    [NOIP2008] 提高组 洛谷P1125 笨小猴
    洛谷P3384 【模板】树链剖分
    Bzoj1503 [NOI2004]郁闷的出纳员
    POJ1422 Air Raid
    洛谷P1133 教主的花园
    洛谷P1186 玛丽卡
    HDU5115 Dire Wolf
    POJ1308 Is It A Tree?
    POJ2513 Colored Sticks
    Bzoj2326 [HNOI2011]数学作业
  • 原文地址:https://www.cnblogs.com/thinksasa/p/3407189.html
Copyright © 2020-2023  润新知