| 订阅 | 在线投稿
分享
 
 
 

PEAR教程(一)--Pear的介绍和安装

来源:互联网  宽屏版  评论
2008-12-28 07:39:30

本文为【PEAR教程(一)--Pear的介绍和安装】的汉字拼音对照版显示拼音

shouxianqingdajiadakaizhegelianjiehttp://pear.php.net/manual/en/womenlaikankanPEARdaodishishenmedong西xidianjiChapter 1. Introduction

PEAR is short for PHP Extension and Application Repository andis pronounced just like the fruit. The purpose of PEAR is toprovide:PearshiPHP Extension and ApplicationRepositorydesuoxiefayinheyingyudanciliyiyangsuoyinikandaozhegewangzhandebiaozhijiushiyigelizi

* A structured library of open-source code for PHP userssuoyouphpkaifazhedoukeyi使shiyongdekaiyuandaimadeku

* A system for code distribution and package maintenanceshiyigedaimafenfadedabaoxitong

* A standard style for code written in PHP, specifiedhereshiyigephpdaimageshidebiaozhun

* The PHP Extension Community Library (PECL), see morebelowshiyigePECLdeku

yijuhuaPEARjiushiyigeqiangdadephpkuwodebloggermapyeshi使shiyongdezhegekuerqiezhegekudepackagehenqiquanbaokuoshujukubiaodandeshengchenghuancunyingyoujinyouhoumianwohuizhubudegeidajiajieshao

duzheyaoqiu1.huidajianWAMPwindow+apache+mysql+phpfuwuqi2.huijiandandephp3.yuanyi使shiyongPEAR

xiamianjieshaoyixiaPEARdeanzhuangzhegehenchongyao:

shouxianshuoshuophpdeincludedelujingwentizhegehejavadeclasspathbijiaoleisiyoumorendepathbirushuophp.inishezhilejigemorendelujing/etc/includehuozhe /etc/DEMO,namezaiphpdedaimazhongruguoyouleisiincludefile.php;debaohanyujuchengxuzhixingdeshihoujiuhuizaidangqianwenjianjiaxiasousuoshifouyoufile.phpzhegewenjianruguomeiyouzaiqusousuo/etc/includehuozhe /etc/DEMOwenjianjiaxiashifouyouzhegewenjianruguoyiranmeiyouzebaocuo

duiyuguowaidexunizhujihenduodouanzhuanglePEARdeerqieanzhuangdePEAR packagedouhenqiquansuoyinizaiphpwenjianzhongyinyong includePEAR.phpchengxujiuhuigenjuphp.inizhaodaoPEARdelujingeryinyongjinlaidanshiruguoxunizhujiweianzhuangPEARjiudewomenzijianzhuangle

anzhuangPEARshiyigehenjiandandeguochengdakebubihaipaxiamianhuanshiyindaodajiaqukanbangzhushoucelianjiezaizheliyouyuhenduorennongbuqingchuPEARdewenjianjiegousuoyizhegemanualbeishanchulebuguomeiyouguanxikeyiquzhegelianjiekankankenenghenshaoyourenyounaixinkanxiaqufanzhengwoshikanbuxiaqudeqishizuiguanjiandejiushizheyixingnajiushigaosunitianjiaphpdemorenincludelujingdefangfa

<?phpini_set(include_path,~/pear/lib.PATH_SEPARATOR.ini_get(include_path));// From PHP 4.3.0 onward, you can use the following,// which especially useful on shared hosts:set_include_path(~/pear/lib.PATH_SEPARATOR.get_include_path());?>haolekaishijieshaoanzhuangbuzhouba

shouxianzaiwangzhandegenmuluxiajianyiwenjianjiatutorranhoujianliyigewenjianjiaincxiazaiPEARmuqianzuixinbandexiazaidizhishihttp://download.pear.php.net/package/PEAR-1.6.1.tgz

xiazaiwanbijieyasuojiangPEARfangzaiincmuluxia,zhankaidemulurutu;

includedefine,].define,WEB_DIR.//PEARmuludelujing

, PEAR_DIR .PATH_SEPARATOR .?>

zaicidakaihttp://127.0.0.1/tutor/demo.php,faxianshenmeyangcuowuxiaoshile

zhiciPEARanzhuangjieshu

原文
首先请大家打开这个链接[url=http://pear.php.net/manual/en/]http://pear.php.net/manual/en/[/url]我们来看看PEAR到底是什么东西,点击Chapter 1. Introduction。 PEAR is short for “PHP Extension and Application Repository” andis pronounced just like the fruit. The purpose of PEAR is toprovide:Pear是”PHP Extension and ApplicationRepository”的缩写,发音和英语单词“梨”一样,所以你看到这个网站的标志就是一个梨子。 * A structured library of open-source code for PHP users所有php开发者都可以使用的开源代码的库 * A system for code distribution and package maintenance是一个代码分发的打包系统 * A standard style for code written in PHP, specifiedhere是一个php代码格式的标准 * The PHP Extension Community Library (PECL), see morebelow是一个PECL的库 … 一句话,PEAR就是一个强大的php库,我的bloggermap也是使用的这个库,而且这个库的package很齐全,包括数据库、表单的生成、缓存应有尽有,后面我会逐步的给大家介绍。 读者要求:1.会搭建WAMP(window+apache+mysql+php)服务器。2.会简单的php3.愿意使用PEAR 下面介绍一下PEAR的安装(这个很重要): 首先说说php的include的路径问题,这个和java的classpath比较类似,有默认的path,比如说php.ini设置了几个默认的路径/etc/include或者 /etc/DEMO,那么在php的代码中,如果有类似“include‘file.php’;”的包含语句,程序执行的时候就会在当前文件夹下搜索是否有file.php这个文件,如果没有,再去搜索/etc/include或者 /etc/DEMO文件夹下是否有这个文件,如果依然没有,则报错! 对于国外的虚拟主机,很多都安装了PEAR的,而且安装的PEAR package都很齐全,所以你在php文件中引用 include“PEAR.php”,程序就会根据php.ini找到PEAR的路径而引用进来,但是如果虚拟主机未安装PEAR,就得我们自己安装了。 安装PEAR是一个很简单的过程,大可不必害怕,下面还是引导大家去看帮助手册,链接在这里(由于很多人弄不清楚PEAR的文件结构,所以这个manual被删除了),不过没有关系,可以去这个链接看看。可能很少有人有耐心看下去,反正我是看不下去的,其实最关键的就是这一行,那就是告诉你添加php的默认include路径的方法 <?phpini_set(‘include_path’,‘~/pear/lib’.PATH_SEPARATOR.ini_get(‘include_path’));// From PHP 4.3.0 onward, you can use the following,// which especially useful on shared hosts:set_include_path(‘~/pear/lib’.PATH_SEPARATOR.get_include_path());?>好了,开始介绍安装步骤吧: 首先在网站的根目录下建议文件夹“tutor”,然后建立一个文件夹inc,下载PEAR,目前最新版的下载地址是[url=http://download.pear.php.net/package/PEAR-1.6.1.tgz]http://download.pear.php.net/package/PEAR-1.6.1.tgz[/url]。 下载完毕解压缩,将PEAR放在inc目录下,展开的目录如图:; includedefine,].define,WEB_DIR.//PEAR目录的路径 , PEAR_DIR .PATH_SEPARATOR .?> 再次打开[url=http://127.0.0.1/tutor/demo.php]http://127.0.0.1/tutor/demo.php[/url],发现什么样?错误消失了! 至此,PEAR安装结束
󰈣󰈤
 
 
 
>>返回首页<<
 
 热帖排行
 
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
©2005- 王朝网络 版权所有