| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> other >> PEAR: chang yong mo kuai
 

PEAR: chang yong mo kuai

2008-12-28 07:39:28 编辑來源:互联网 评论
 
本文为【PEAR:常用模块】的拼音翻译版
  zai shang yi pian , wo men jie shao le PEAR de gai nian , bian ma gui ze , jian dan shi yong fang fa , ni ke neng dui ta you le yi ge chu bu de le jie 。 zhe ci , wo men jiang jie shao xian you de PEAR ku zhong de yi xie mo kuai de gong neng he ta de shi yong 。
  yi 、 ming ming yue ding
  zai le jie xian you de pear mo kuai zhi qian , wo men xian le jie yi xia PEAR de zu zhi fen lei fang shi he ming ming de yue ding 。PEAR zhong de mo kuai de zu zhi fang shi he CPAN lei si , mei ge mo kuai de xiang guan wen jian shi fang zai zi ji de fen lei mu lu xia mian , you de ze shi zhi jie fang zai pear de gen mu lu xia mian ( dan ge wen jian )。 you yu PEAR mei you xiang java na yang de ming zi kong jian , suo yi ni de lei ming ying gai neng gou ti xian ni de mo kuai ming huo zhe fu lei ming zhi jian de guan xi , shou yi ding de yue ding , bi ru , ni de mo kuai ming :"Mp3/common", na me , ni de php wen jian ying gai wei yu :Mp3/common.php, ni zhe ge mo kuai de lei ming ying gai shi :Mp3_common。 yi ban lai shuo , ru guo ni de mo kuai shi gen ju xian you de mou ge mo kuai gai jin er lai de , na me jian yi ba ni de he xian you de na ge mo kuai fang zai tong yi ge mu lu xia mian 。 ru guo ni she ji de shi yi ge xin de lei he mo kuai , ni ke yi zi ji jian li yi ge xin de mu lu , huo zhe shi an zhao xiang si de yong tu fang zai tong yang de mu lu xia mian 。 bi ru , ni xin bian xie le yi ge mo kuai , yong yu chu li ri zhi de , jian yi ni ba ta fang zai Log/ xia mian , biao shi shi yong yu Log chu li de ying yong mo kuai ; ru guo xin de mo kuai shi yong yu chu li mp3 de , na me ni ke yi jian li yi ge xin de mu lu mp3, fang zai mp3 mu lu xia mian 。
  er 、 xian you de PEAR mo kuai
  you yu Pear de da duo shu mo kuai reng chu yu kai fa dang zhong , yin ci , zhe li lie ju de shi sui zhe php4.05 yi qi fa bu de pear zhong de mo kuai , xu yao zhu yi de shi , yi xie chou xiang lei huo zhe shi ji lei ( ru Mail.php,Log.php,Cache.php) mei you lie ju chu lai , wo men zhi shi guan zhu ju you ju ti gong neng de mo kuai 。 xia mian shi zhe xie mo kuai de yi ge lie biao :
  Benchmark/Timer ce shi ni de yi duan php dai ma de yun xing xiao lv
  Benchmark/Benchmark_Iterate ce shi ni mou ge han shu xun huan zhi xing shi de xing neng
  Cache/Output ke yi jiang ni de php jiao ben de shu chu jin xing huan cun , ke yi shi yong duo zhong fang shi huan cun ( cun zai wen jian , shu ju ku huo zhe shi gong xiang nei cun zhong ), ru guo shi yong zhe ge mo kuai you ke neng zeng da fu wu qi de fu zai , suo yi , ru guo ni xiang tong guo dong tai jiao ben de huan cun lai ti gong xiao lv , bu fang shi yong Zend optimize, zhe ge mo kuai wei bi shi he
  Cache/Graphics ke yi jiang ni xu yao dong tai shu chu de tu pian jin xing huan cun
  Console/Getopt ming ling xing shen shu de chu li mo kuai
  CMD yi ge xu ni de shell, ke yi yong ta lai yun xing yi xie xi tong de ming ling
  Crypt/CBC shi xian Perl Crypt::CBC mo kuai de fang zhen
  Crypt/HCEMD5 shi xian Perl Crypt::HCE_MD5 mo kuai de gong neng
  Date/Calc shi xian ri qi de xiang guan cao zuo
  Date/Human Human li fa de zhuan huan
  DB ti gong tong yi de 、 chou xiang de shu ju ku cao zuo ceng , hou duan zhi chi duo zhong shu ju ku
  File/Find wen jian cha zhao
  File/Passwd cao zong password lei de wen jian , ru password,httppass,cvspassword
  File/SearchReplace zai wen jian zhong cha zhao ti huan zi fu chuan
  HTML/Form ke yi zai html zhong kuai su di chuang jian form
  HTML/IT shi xian mo ban ding zhi , dong tai sheng cheng ye mian de gong neng , lei si phplib zhong de mo ban gong neng , dan shi yao jian dan yi yong
  HTML/ITX shi xian dui IT de kuo zhan gong neng , ke yi geng jia ling huo di ding zhi ni de mo ban , shi xian geng fu duo de cao zuo
  HTML/Processor XML_Parser de kuo zhan , shi zhi ke yi ying yong yu html wen jian de cao zuo
  HTTP/Compress yong yu Php shu chu huan chong ji zhi de yi ge bao zhuang lei , tong shi ke yi dui huan chong de nei rong jin xing ya suo cun chu
  Image/Remote wu xu ba zheng ge tu pian dou xia zai dao ben di jiu ke yi huo qu yuan duan xi tong de tu pian de xin xi ,
  Log/composite Horde dui log chou xiang lei zuo de yi ge kuo zhan , ke yi shi duo ge ri zhi chu li dui xiang neng gou huo de tong yi ge ri zhi shi jian 。 zhu yi ,Log mu lu xia mian de mo kuai dou shi Horde xiang mu de yi bu fen , da bu fen dou shi chou xiang de chao lei
  Log/file jiang ri zhi xin xi xie ru wen jian
  Log/mcal jiang xin xi fa song dao ben di huo yuan duan de ri cheng guan li ruan jian -mcal de shu ju ku zhong
  Log/observer Horder zhong Observer de yi ge chao lei
  Log/sql jiang ri zhi xin xi fa song dao sql shu ju ku zhong
  Log/syslog jiang xin xi fa song dao syslog zhong
  Mail/RFC822 jian cha yi ge email di zhi shi fou shi he fa de rf822 email di zhi
  Mail/sendmail shi yong sendmail lai fa song xin jian
  Mail/smtp shi yong smtp fu wu qi lai fa song xin jian
  Math/Fraction chu li fen xing de shu xue ji suan
  Math/Util ji suan zui da gong yue shu
  NET/Curl dui php de Curl kuo zhan suo zuo de mian xiang dui xiang de bao zhuang
  NET/Dig cao zong dig, jin xing dns xiang guan de cha xun cao zuo
  NET/SMTP shi yong NET/Socket shi xian SMTP xie yi
  NET/Socket tong yong de Socket lei , shi xian le chang yong de socket cao zuo de bao zhuang
  Numbers/Roman a la bo shu zi he luo ma shu zi de xiang hu zhuan huan
  Payment/Verisign shi xian he Verisign zhi fu wang guan de jiao hu
  Pear ti gong Pear mo kuai de 2 ge ji ben lei ,PEAR he PEARError lei
  PEAR/Installer pear de an zhuang lei , ti gong Perl zhong de CPAN mo kuai lei si de gong neng
  PHPDoc cong php dai ma zhong zi dong sheng cheng API wen dang
  Schedule/at he Unix shang de AT shou hu jin cheng jin xing jiao hu
  XML/Parser ji yu php de xml kuo zhan suo zuo de xml de jie xi qi
  XML/Render jiang xml wen dang sheng cheng qi ta de ge shi (html,pdf), zhe zhi shi yi ge chou xiang lei , zai zui xin de pear cvs dai ma zhong yi jing you le html de shi xian
  XML/RPC yong php shi xian xml-rpc de yi ge chou xiang lei , zai zui xin de pear cvs dai ma zhong yi jing you le xml/RPC/Server de shi xian
  san 、 zhu yao mo kuai shi yong jian jie
  xian zai wo men jiang jian dan di jie shao yi xie bi jiao chang yong de , er qie gong neng yi jing bi jiao wan shan he wen ding , ke yi yong yu “ shi zhan “ mo kuai , qi zhong dui yu ji ge gong neng hen qiang da de mo kuai Db,phpdoc,XML_Parser,IT,ITX jiang zai yi hou de wen zhang zhong dan du jie shao 。
  1.PEAR/Installer
  zhe ge mo kuai shu yu pear ben shen de gai xin mo kuai , ta wan cheng pear qi ta mo kuai de an zhuang he wei hu gong zuo , lei si perl zhong de cpan mo kuai de gong neng , bu guo mu qian zhi you install gong neng , qi ta zhu ru cha xun , jian cha yi lai xing deng deng dou mei you wan cheng ,pear ben shen ye mei you lei si cpan na yang de kai fang de zhan dian , bu guo sui zhe shen yu pear de kai fa ren yuan de bu duan zeng jia , yi qie dou hui you de 。
  shi yong yu fa :PEAR_Installer::installer($file)
  $file shi xu yao an zhuang de mo kuai wen jian , ke yi shi ben di wen jian , ye ke yi shi yuan cheng de wen jian , ru http:// huo zhe shi ftp,installer hui zi dong xia zai dao ben di 。 wen jian yi ban shi yong gzip da bao , qi zhong yao bao kuo yi ge package.xml wen jian , yong yu miao shu ni de zhe ge mo kuai de xiang guan xin xi , ru bao han de wen jian , xiang hu yi lai xing deng , ci wai dang ran yao bao kuo ni de mo kuai de php wen jian 。pacakage.xml de DTD wen jian zai pear mu lu xia mian , ming zi shi package.dtd.
  <?php
  require_once "PEAR/Installer.php";
  $installer = new PEAR_Installer;
  // an zhuang zhi ding de mo kuai
  $result = $installer->install($package_file);
  if ( PEAR::isError($result)){
  echo "Install $package_file failed!";
  }else {
  echo "Install $package_file sucess!";
  }
  ?>
  2.CMD
  sui ran da duo shu de php ying yong hen shao tiao yong xi tong ming ling , yin wei zhe xie ying yong dou shi ji yu web de , cong yun xing xiao lv he xi tong de fu zai kao lv , dou yao bi mian zhi jie tiao yong xi tong ming ling , bu guo , zai you xie te shu de ying yong huo zhe shi ni yuan yi ba php zuo wei yi ge shell gong ju de shi hou , tiao yong xian you de xi tong gong ju jiu shi bu ke bi mian de le 。CMD ke yi rang ni hen fang bian di zhi xing yi xi lie de xi tong ming ling 。
  shi yong yu fa :setOption ($option, $setting)
  she zhi shen shu $options wei $setting
  $options shi yi ge chang liang , ta ke yi shi yi xia zhi :
  CMD_SHUTDOWN : tong guo shutdown han shu lai zhi xing ming ling
  CMD_SHELL : zhi ding shell de lu jing
  CMD_OUTPUT : shi fou ping bi ming ling de biao zhun shu chu
  CMD_NOHUP : shi yong nohup hou tai zhi xing ming ling
  CMD_VERBOSE : jiang cuo wu da yin dao biao zhun shu chu
  command($command)
  tian jia xu yao zhi xing de ming ling ,$command ke yi shi shu zu huo pu tong de zi fu chuan
  exec()
  zhi xing yi jing tian jia de ming ling
  <?php
  require_once "CMD.php";
  $cmd = new CMD;
  $cmd->command('tar zcvf test.tar.gz ~/test');
  if ( $cmd->exec() ) {
  echo "success!\n";
  } esle {
  echo "Error:" . $cmd->lastError;
  }
  ?>
  3.Benchmark/Timer he Benchmark/Iterate
  zhe 2 ge mo kuai ke yi rang ni ce shi ni de dai ma de yun xing xiao lv ru he , wo ren wei zhe dui yu xi tong tiao shi hen you yong : ni ke yi chang shi bu tong de suan fa , zai xi kao cha mei zhong suan fa xu yao yun xing de shi jian , ran hou xuan ze zui jia de fang shi 。Benchmark/Timer ce shi yun xing zhong zai 2 ge bu tong de shi jian dian de shi jian cha ,Benchmark/Iterate ze shi dui Timer kuo zhan , ce shi yun xing mou duan dai ma ( han shu )n ci suo xu yao de shi jian 。
  shi yong yu fa :Benchmark/Timer
  Timer::setMarker($name) she zhi dang qian shi jian dian wei $name
  Timer::start() kai shi ce shi
  Timer::stop() ting zhi ce shi
  Timer::timeElapsed($start = 'Start', $end = 'Stop') ji suan $start he $end zhe 2 ge shi jian dian de shi jian cha
  Timer::getProfiling() fan hui start he stop zhi jian suo hao yong de shi jian
  <?php
  require_once "Benchmark/Timer.php";
  $timer = new Benchmark_Timer;
  $timer->start();
  $timer->setMarker('Marker 1');
  $timer->stop();
  $profiling = $timer->getProfiling();
  ?>
  Benchmark/Iterate
  Iterate::run()
  xun huan yun xing zhi ding de han shu 。 zhe shi yi ge ju you ke bian shen shu de fang fa , di yi ge shen shu shi yao xun huan de ci shu , di 2 ge shen shu shi yao zhi xing de han shu , di 3 ge shen shu qi ze shi yao chuan di gei ce shi han shu de shen shu 。
  Iterate::get()
  fan hui ce shi suo yong de shi jian
  <?php
  require_once "Benchmark/Iterate.php";
  $benchmark = new Benchmark_Iterate;
  function foo($string)
  {
  print $string."
  ";
  }
  $benchmark->run(100, 'foo', 'test');
  $result = $benchmark->get();
  ?>
  3.File/Find
  &glob ($pattern, $dirpath, $pattern_type='php')
  zai $dirpath zhong sou suo fu he $pattern de mu lu he wen jian , fan hui pi pei de wen jian he mu lu ming shu zu
  &search ($pattern, $directory, $type='php')
  zai $directory zhong sou suo fu he $pattern gui ze de wen jian , fan hui pi pei de wen jian ming shu zu ( zhu yi , zhi shi wen jian , bu bao kuo zi mu lu )。$pattern shi yao zhi ding de sou suo tiao jian , yi ban shi gui ze biao da shi ,$patten_type zhi ding shi yong shen me mo shi de gui ze biao da shi , que sheng shi php mo shi , ni ye ke yi zhi ding "perl" lai shi yong perl mo shi de gui ze biao da shi
  ti shi :search he glob bu tong de shi ,glob bing bu di gui sou suo zi mu lu , er search ze di gui sou suo zi mu lu 。
  <?php
  require_once "File/Find.php";
  $find = new File_Find;
  // sou suo dang qian mu lu
  $php_files = $find->glob("*php",".");
  if ( PEAR::isError( $php_files ) ){
  die " cuo wu :" . $php_files->getMessage() ."\n" ;
  }
  // di gui sou suo dang qian mu lu
  $all_php_files = $find->search("*php",".");
  if ( PEAR::isError( $all_php_files ) ){
  die " cuo wu :" . $php_files->getMessage() ."\n" ;
  }
  ?>
  4.File/Passwd
  cao zong password ge shi de wen jian , lei si ru biao zhun de unix password,apache de .htppass,cvs de pserver password wen jian 。 cong xian you ban ben de dai ma lai kan , ta huan bu neng zhen zheng di yong lai wei hu zhe xie passwd wen jian ( bi ru bing bu zhi chi shadow)。 bu guo ni ke yi yong lai chuang jian lei si de mi ma wen jian , dang ran , an quan xing bu hui hen gao 。
  shi yong fang fa :
  File_Passwd($file,$lock=0)---------- chuang jian dui xiang ,$file shi ni yao cao zuo de passwd wen jian ,$lock zhi ding shi fou yao yong flock dui wen jian shang suo 。
  addUser($user,$pass,$cvsuser)---------- zeng jia yi ge yong hu ,$user,$pass fen bie shi yong hu ming he mi ma ,$cvsuser shi cvs yong hu de id
  modUser($user,$pass,$cvsuser)---------- xiu gai $user de mi ma wei $pass,$cvsuser shi cvs yong hu de id
  delUser($user)---------- shan chu zhi ding de yong hu $user
  verifyPassword($user,$pass)---------- jian yan yong hu mi ma
  close()---------- bao cun gang cai de xiu gai dao password wen jian , guan bi password wen jian , dui wen jian jie suo 。
  5.File/SearchReplace
  zai wen jian zhong cha zhao he ti huan zi fu chuan
  shi yong fang fa :File_SearchReplace($find, $replace, $files, $directories = '', $include_subdir = 1, $ignore_lines = array())
  sheng cheng bing she zhi dui xiang
  $find
  yao cha zhao de zi fu chuan , ke yi shi zi fu chuan huo gui ze biao da shi
  $replace
  yao ti huan cheng de zi fu chuan , ke yi shi zi fu chuan huo gui ze biao da shi
  $files
  zhi ding zai na xie wen jian zhong jin xing ti huan cao zuo , shu zu huo zhe shi yi "," fen ge de yi ge zi fu chuan
  $directories
  zhi ding zai na ge mu lu zhong cao zuo , ke xuan , shu zu huo zhe shi yi "," fen ge de yi ge zi fu chuan
  $include_subdir
  ru guo shi zai mu lu zhong cao zuo , zhi ding shi fou zai zi mu lu zhong di gui zhi xing shang shu cao zuo , ke yi shi shu zhi 1 huo 0。
  $ignore_lines
  zhi ding yao hu lue de wen jian xing , zhe shi yi ge shu zu , ren he yi zhe ge shu zu zhong ren yi yi ge zi fu chuan kai shi de wen jian xing , dou hui hu lue 。
  getNumOccurences()
  fan hui yi jing zhi xing le cha zhao ti huan de ci shu
  getLastError()
  fan hui shang yi ci de cuo wu xin xi
  setFind($find)
  she zhi yao cha zhao de zi fu chuan
  setReplace($replace)
  she zhi yao ti huan de zi fu chuan
  setFiles($files)
  she zhi yao zhi xing ti huan cao zuo de wen jian
  setDirectories($directories)
  she zhi yao ti huan cao zuo de mu lu
  setIncludeSubdir($include_subdir)
  she zhi shi fou zai zi mu lu zhong ye zhi xing cha zhao ti huan
  setIgnoreLines($ignore_lines)
  she zhi yao hu lue de xing , zhi neng zai shi yong "normal" sou suo han shu de shi hou shi yong
  setSearchFunction($search_function)
  she zhi yao shi yong de sou suo han shu , ke yi shi xia lie shen shu :
  normal que sheng zhi , shi yong file han shu du ru wen jian nei rong , ran hou shi yong str_replace zhu xing de jin xing ti huan 。
  quick shi yong str_replace zhi jie dui zheng ge wen jian jin xing ti huan
  preg shi yong preg_replace() lai jin xing ti huan , ni ke yi shi yong fu he zhe ge han shu yao qiu de gui ze biao da shi
  ereg shi yong ereg_replace() lai jin xing ti huan , ni ke yi shi yong fu he zhe ge han shu yao qiu de gui ze biao da shi
  doSearch()
  zhi xing cha zhao ti huan cao zuo
  <?php
  require_once "File/SearchReplace.php";
  require_once "File/Find";
  // di gui sou suo dang qian mu lu
  $find = new File_Find;
  $all_php_files = $find->search("*php",".");
  if ( PEAR::isError( $all_php_files ) ){
  die " cuo wu :" . $php_files->getMessage() ."\n" ;
  }
  if ( !count($all_php_file) ){
  die "NO php source files found!\n";
  }
  // jiang <? de php biao zhi xiu zheng cheng <?php, yi fu he pear biao zhun
  $replace = new File_SearchReplace('<? ','<?php ',$all_php_files);
  $replace->doSearch();
  if ( $replace->getLastError() ) {
  die " fa sheng cuo wu :" . $replace->getLastError() ;
  } else {
  echo " gong cheng gong ti huan le " . $replace->getNumOccurences() . " chu 。\n";
  }
  ?>
  6.HTML/Form
  zhe ge mo kuai ke yi rang ni kuai su di sheng cheng yi ge ti jiao de chuang ti , er wu xu chong xin qu bian xie html dai ma
  shi yong fang fa :Form::HTML_Form($action, $method = 'GET', $name = '', $target = '')
  zhe ge lei de gou zao han shu dai you yi xie shen shu , zhe xie shen shu he tong chang yao bian xie html dai ma zhong de form shen shu shi ji ben yi zhi de ,$action shi zai form zhong yao ti jiao dao de URL,$name ke yi zhi ding form de ming zi ,$target zhi ding shi fou yao xin kai chuang kou deng deng 。
  xia mian de addXXX xi lie fang fa , yong yu zai zhe ge form zhong tian jia xiang ying de kong jian , kong jian de shu xing he html zhong de ye xiang yi zhi 。
  addText($name, $title, $default, $size = HTML_FORM_TEXT_SIZE)
  addCheckbox($name, $title, $default)
  addTextarea($name, $title, $default,$width = HTML_FORM_TEXTAREA_WT,$height = HTML_FORM_TEXTAREA_HT)
  addPassword($name, $title, $default, $size = HTML_FORM_PASSWD_SIZE)
  addSubmit($name = "submit", $title = "Submit Changes")
  addReset($title = "Discard Changes")
  addSelect($name, $title, $entries, $default = '', $size = 1,$blank = '', $multiple = false, $attribs = '')
  addRadio($name, $title, $value, $default)
  addImage($name, $src)
  addHidden($name, $value)
  Display()
  xian shi zhe ge chuang ti
  <?php
  require_once "HTML/Form.php";
  // chuang jian bing xian shi deng lu chuang ti
  $myform = new HTML_Form("./login.php");
  $myform->addText('username',' yong hu ming ','');
  $myform->addPasswd('passwd',' deng lu mi ma ',20);
  $myform->addHidden('retry','1');
  $myform->addSumit('login',' deng lu ');
  $myform->Display();
  ?>
  7.Mail/RFC822
  jian cha yi ge shu ru de email shi fou he fa , bu shi yi jian hen qing song de shi qing , ni ye xu chang shi shi yong yi xie gui ze biao da shi lai jian cha , dan shi bing fei na me fang bian you xiao 。 xian zai , ru guo yao jian cha yi xi lie de you jian di zhi shi fou fu he RFC822 biao zhun , bing ba ta men chai fen cheng dan du de email di zhi , ni ke yi shi shi zhe ge mo kuai , fei chang jian dan shi yong 。
  shi yong fang fa :Mail_RFC822($address = null, $default_domain = null, $nest_groups = null, $validate = null)
  lei gou zao han shu ,$address shi ni yao yan zheng de yi xi lie de di zhi ,$default_domain, zhi ding que sheng de yu ming huo zhe zhu ji ming ,$nest_groups shi fou zai shu chu jie guo zhong jin xing fen zu , yi bian xian shi $validate shi fou xu yao yan zheng mei ge yuan zi parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null) fen xi yan zheng suo gei ding de di zhi lie biao , ru guo di zhi you xiao , fan hui chai fen hou de dan du de di zhi lie biao , ru guo fa sheng cuo wu , ze fan hui cuo wu xin xi 。
  <?php
  require_once "Mail/RFC822.php";
  $rf822 = new Mail_RFC822;
  $result=$rf822->paseAddressList('who;whoim@hotmail.com;test@test.ch');
  if ( $rf822->error ){
  echo "Error:$result";
  }else {
  reset($result);
  for ($i=0; $i< count($result);$i++){
  echo "email:$result[$i]\n";
  }
  }
  ?>
  8.Mail/Sendmail
  sendmail shi unix/linux shang mian zui chang yong de MTA, zhe ge mo kuai ke yi rang ni zhi jie shi yong sendmail lai fa song xin jian
  shi yong fang fa :Mail_sendmail($params)
  lei gou zao han shu ,$params shi yi ge guan lian shu zu , ni ke yi she ding sendmail de shen shu , mu qian zhi you 'sendmail_path' shi you xiao de , yong lai she zhi sendmail de lu jing send($recipients, $headers, $body) fa song xin jian ,$recipients shi ni de shou jian ren de email di zhi , ke yi shi dan ge , ye ke yi shi yong ; ge kai de di zhi lie biao , zhi yao fu he RFC82 biao zhun jiu ke yi 。$headers shi ni fa song xin jian de xin tou , zhe shi yi ge guan lian shu zu , shu zu de guan jian zi shi xin tou de ming zi ( ru Subject), shu zu zhi ze shi xin tou de zhi ( bi ru :Hello!)。 chu li hou de xin tou jiang hui shi :Subject:Hello! $body shi xin jian de xin ti , bao kuo suo you de MIME bian ma hou de bu fen 。 ru guo cheng gong , fan hui zhen , fou ze fan hui yi ge PEAR_Error dui xiang
  <?php
  require_once "Mail/sendmail.php";
  $sendmail = new Mail_sendmail(array('sendmail_path=>'/usr/local/bin/sendmail'));
  $header = array('Subject'=>'Hello','BCC'=>'test2@hotmail.com');
  $body = 'This is a test message from nightsailer.com';
  $result = $sendmail->send('test@nightsailer.com', $header, $body);
  if ( PEAR::isError($result) ){
  echo "<h1> fa song shi bai </h1><br> yuan yin :".$result->getMessage()."<br>";
  }else {
  echo "<h1> gong xi ! fa song cheng gong !</h1><br>";
  }
  ?>
  9.Mail/smtp
  dui yu xian zai you xie zhan dian bu yuan xu shi yong sendmail, na me ru guo ni de php cheng xu xi wang shi yong fa xin gong neng , jiu xu yao neng gou tong guo shi yong wai bu de smtp fu wu qi lai wan cheng xiang ying de gong neng le 。
  shi yong fang fa : shi yong shang zhe ge mo kuai he Mail::sendmail ji ben shang shi yi yang de 。 xu yao zhu yi de shi : zhe ge mo kuai xu yao shi yong Net::SMTP mo kuai :Mail_smtp($params)
  $params de you xiao shen shu shi :
  'host' smtp de fu wu qi di zhi , que sheng shi localhost
  'port' smtp fu wu duan kou , que sheng shi 25
  'auth' smtp shi fou xu yao shou quan yan zheng , que sheng shi false
  'usename' smtp shou quan de yong hu ming
  'password' smtp shou quan de mi ma
  send($recipients, $headers, $body)
  fa song
  <?php
  require_once "Mail/sendmail.php";
  $params=array('host'=>'smtp.nightsailer.com','auth'=true,
  'username'=>'night','password'=>'123456');
  $sendmail = new Mail_sendmail($params);
  $header = array('Subject'=>'Hello','BCC'=>'test2@hotmail.com');
  $body = 'This is a test message from nightsailer.com';
  $result = $sendmail->send('test@nightsailer.com', $header, $body);
  if ( PEAR::isError($result) ){
  echo "<h1> fa song shi bai </h1><br> yuan yin :".$result->getMessage()."<br>";
  }else {
  echo "<h1> gong xi ! fa song cheng gong !</h1><br>";
  }
  ?>
  10.Schedule/At
  zhe ge mo kuai ti gong le unix shang mian de at cheng xu de jie kou
  add($cmd, $timespec, $queue = false, $mail = false )
  zhui jia yi ge at ming ling
  zhe ge fang fa jiang wei at cheng xu sheng cheng yi ge ding zhi de zuo ye :
  $cmd shi ni yao yun xing de cheng xu huo jiao ben
  $timespec shi zuo ye kai shi zhi xing de shi jian , ge shi yu at yao qiu de xiang tong
  $queue ke xuan shen shu , zhi ming zuo ye de dui lie ming
  $mail ke xuan shen shu , zhi ming shi fou zai zuo ye jie shu hou yao fa song email hui bao yun xing jie guo
  show($queue = false)
  xian shi zai at dui lie zhong de ming ling , fan hui yi ge guan lian shu zu , shu zu de key shi zuo ye de bian hao , xiang ying de jian zhi ye shi yi ge guan lian shu zu , nei rong shi array(runtime,queue)$queue shi yi ge ke xuan shen shu , ni ke yi yong ta xian ding zhi fan hui dui lie zhong dui lie ming pi pei $queue de zuo ye lie biao
  remove($job = false)
  cong at dui lie zhong shan chu zhi ding de at zuo ye $job shi yao shan chu de zuo ye bian hao , ru guo , cheng gong , fan hui true, fou ze fan hui false
  <?php
  require_once "Schedule/At.php";
  $at = new Schedule_At();
  // sheng cheng bing zhui jia yi ge zuo ye
  $result = $at->add ('find / -type file -name core -exec rm -f {} \;','00:00');
  if ( PEAR::is_Error($result) ) {
  echo " wu fa zhui jia zuo ye !\n";
  echo " yuan yin :$result->getMessage() \n";
  exit;
  }
  // xian shi dang qian at dui lie
  $queue = $at->show();
  if ( PEAR::isError($queue) ) {
  echo " fa sheng cuo wu !\n";
  echo " yuan yin :" . queue->getMessage(). "\n";
  exit;
  }
  reset( $queue );
  while ( list($job, $cmd) = each $queue ){
  echo "[$job]" . $cmd['runtime'] . "-" .$cmd['queue'];
  echo "\n"
  }
  ?>
  yi shang shi yi xie PEAR mo kuai de shi yong , geng wei xiang xi de shuo ming xu yao ni zi ji qu cha kan zhe xie mo kuai de yuan wen jian , huo zhe ni ke yi shi yong phpdoc zi dong sheng cheng zhe xie mo kuai de api wen dang 。 guan yu phpdoc, wo men jiang zai xia pian xiang xi tao lun 。
  si 、 zi yuan
  PEAR CVS ni ke yi cong zhe li huo de zui xin de PEAR yuan ma
  Hoder xiang mu
  PHPDoc zhu ye【原文】【汉音对照
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
zai shang yi pian , wo men jie shao le PEAR de gai nian , bian ma gui ze , jian dan shi yong fang fa , ni ke neng dui ta you le yi ge chu bu de le jie 。 zhe ci , wo men jiang jie shao xian you de PEAR ku zhong de yi xie mo kuai de gong neng he ta de shi yong 。 yi 、 ming ming yue ding zai le jie xian you de pear mo kuai zhi qian , wo men xian le jie yi xia PEAR de zu zhi fen lei fang shi he ming ming de yue ding 。PEAR zhong de mo kuai de zu zhi fang shi he CPAN lei si , mei ge mo kuai de xiang guan wen jian shi fang zai zi ji de fen lei mu lu xia mian , you de ze shi zhi jie fang zai pear de gen mu lu xia mian ( dan ge wen jian )。 you yu PEAR mei you xiang java na yang de ming zi kong jian , suo yi ni de lei ming ying gai neng gou ti xian ni de mo kuai ming huo zhe fu lei ming zhi jian de guan xi , shou yi ding de yue ding , bi ru , ni de mo kuai ming :"Mp3/common", na me , ni de php wen jian ying gai wei yu :Mp3/common.php, ni zhe ge mo kuai de lei ming ying gai shi :Mp3_common。 yi ban lai shuo , ru guo ni de mo kuai shi gen ju xian you de mou ge mo kuai gai jin er lai de , na me jian yi ba ni de he xian you de na ge mo kuai fang zai tong yi ge mu lu xia mian 。 ru guo ni she ji de shi yi ge xin de lei he mo kuai , ni ke yi zi ji jian li yi ge xin de mu lu , huo zhe shi an zhao xiang si de yong tu fang zai tong yang de mu lu xia mian 。 bi ru , ni xin bian xie le yi ge mo kuai , yong yu chu li ri zhi de , jian yi ni ba ta fang zai Log/ xia mian , biao shi shi yong yu Log chu li de ying yong mo kuai ; ru guo xin de mo kuai shi yong yu chu li mp3 de , na me ni ke yi jian li yi ge xin de mu lu mp3, fang zai mp3 mu lu xia mian 。 er 、 xian you de PEAR mo kuai you yu Pear de da duo shu mo kuai reng chu yu kai fa dang zhong , yin ci , zhe li lie ju de shi sui zhe php4.05 yi qi fa bu de pear zhong de mo kuai , xu yao zhu yi de shi , yi xie chou xiang lei huo zhe shi ji lei ( ru Mail.php,Log.php,Cache.php) mei you lie ju chu lai , wo men zhi shi guan zhu ju you ju ti gong neng de mo kuai 。 xia mian shi zhe xie mo kuai de yi ge lie biao : Benchmark/Timer ce shi ni de yi duan php dai ma de yun xing xiao lv Benchmark/Benchmark_Iterate ce shi ni mou ge han shu xun huan zhi xing shi de xing neng Cache/Output ke yi jiang ni de php jiao ben de shu chu jin xing huan cun , ke yi shi yong duo zhong fang shi huan cun ( cun zai wen jian , shu ju ku huo zhe shi gong xiang nei cun zhong ), ru guo shi yong zhe ge mo kuai you ke neng zeng da fu wu qi de fu zai , suo yi , ru guo ni xiang tong guo dong tai jiao ben de huan cun lai ti gong xiao lv , bu fang shi yong Zend optimize, zhe ge mo kuai wei bi shi he Cache/Graphics ke yi jiang ni xu yao dong tai shu chu de tu pian jin xing huan cun Console/Getopt ming ling xing shen shu de chu li mo kuai CMD yi ge xu ni de shell, ke yi yong ta lai yun xing yi xie xi tong de ming ling Crypt/CBC shi xian Perl Crypt::CBC mo kuai de fang zhen Crypt/HCEMD5 shi xian Perl Crypt::HCE_MD5 mo kuai de gong neng Date/Calc shi xian ri qi de xiang guan cao zuo Date/Human Human li fa de zhuan huan DB ti gong tong yi de 、 chou xiang de shu ju ku cao zuo ceng , hou duan zhi chi duo zhong shu ju ku File/Find wen jian cha zhao File/Passwd cao zong password lei de wen jian , ru password,httppass,cvspassword File/SearchReplace zai wen jian zhong cha zhao ti huan zi fu chuan HTML/Form ke yi zai html zhong kuai su di chuang jian form HTML/IT shi xian mo ban ding zhi , dong tai sheng cheng ye mian de gong neng , lei si phplib zhong de mo ban gong neng , dan shi yao jian dan yi yong HTML/ITX shi xian dui IT de kuo zhan gong neng , ke yi geng jia ling huo di ding zhi ni de mo ban , shi xian geng fu duo de cao zuo HTML/Processor XML_Parser de kuo zhan , shi zhi ke yi ying yong yu html wen jian de cao zuo HTTP/Compress yong yu Php shu chu huan chong ji zhi de yi ge bao zhuang lei , tong shi ke yi dui huan chong de nei rong jin xing ya suo cun chu Image/Remote wu xu ba zheng ge tu pian dou xia zai dao ben di jiu ke yi huo qu yuan duan xi tong de tu pian de xin xi , Log/composite Horde dui log chou xiang lei zuo de yi ge kuo zhan , ke yi shi duo ge ri zhi chu li dui xiang neng gou huo de tong yi ge ri zhi shi jian 。 zhu yi ,Log mu lu xia mian de mo kuai dou shi Horde xiang mu de yi bu fen , da bu fen dou shi chou xiang de chao lei Log/file jiang ri zhi xin xi xie ru wen jian Log/mcal jiang xin xi fa song dao ben di huo yuan duan de ri cheng guan li ruan jian -mcal de shu ju ku zhong Log/observer Horder zhong Observer de yi ge chao lei Log/sql jiang ri zhi xin xi fa song dao sql shu ju ku zhong Log/syslog jiang xin xi fa song dao syslog zhong Mail/RFC822 jian cha yi ge email di zhi shi fou shi he fa de rf822 email di zhi Mail/sendmail shi yong sendmail lai fa song xin jian Mail/smtp shi yong smtp fu wu qi lai fa song xin jian Math/Fraction chu li fen xing de shu xue ji suan Math/Util ji suan zui da gong yue shu NET/Curl dui php de Curl kuo zhan suo zuo de mian xiang dui xiang de bao zhuang NET/Dig cao zong dig, jin xing dns xiang guan de cha xun cao zuo NET/SMTP shi yong NET/Socket shi xian SMTP xie yi NET/Socket tong yong de Socket lei , shi xian le chang yong de socket cao zuo de bao zhuang Numbers/Roman a la bo shu zi he luo ma shu zi de xiang hu zhuan huan Payment/Verisign shi xian he Verisign zhi fu wang guan de jiao hu Pear ti gong Pear mo kuai de 2 ge ji ben lei ,PEAR he PEARError lei PEAR/Installer pear de an zhuang lei , ti gong Perl zhong de CPAN mo kuai lei si de gong neng PHPDoc cong php dai ma zhong zi dong sheng cheng API wen dang Schedule/at he Unix shang de AT shou hu jin cheng jin xing jiao hu XML/Parser ji yu php de xml kuo zhan suo zuo de xml de jie xi qi XML/Render jiang xml wen dang sheng cheng qi ta de ge shi (html,pdf), zhe zhi shi yi ge chou xiang lei , zai zui xin de pear cvs dai ma zhong yi jing you le html de shi xian XML/RPC yong php shi xian xml-rpc de yi ge chou xiang lei , zai zui xin de pear cvs dai ma zhong yi jing you le xml/RPC/Server de shi xian san 、 zhu yao mo kuai shi yong jian jie xian zai wo men jiang jian dan di jie shao yi xie bi jiao chang yong de , er qie gong neng yi jing bi jiao wan shan he wen ding , ke yi yong yu “ shi zhan “ mo kuai , qi zhong dui yu ji ge gong neng hen qiang da de mo kuai Db,phpdoc,XML_Parser,IT,ITX jiang zai yi hou de wen zhang zhong dan du jie shao 。 1.PEAR/Installer zhe ge mo kuai shu yu pear ben shen de gai xin mo kuai , ta wan cheng pear qi ta mo kuai de an zhuang he wei hu gong zuo , lei si perl zhong de cpan mo kuai de gong neng , bu guo mu qian zhi you install gong neng , qi ta zhu ru cha xun , jian cha yi lai xing deng deng dou mei you wan cheng ,pear ben shen ye mei you lei si cpan na yang de kai fang de zhan dian , bu guo sui zhe shen yu pear de kai fa ren yuan de bu duan zeng jia , yi qie dou hui you de 。 shi yong yu fa :PEAR_Installer::installer($file) $file shi xu yao an zhuang de mo kuai wen jian , ke yi shi ben di wen jian , ye ke yi shi yuan cheng de wen jian , ru http:// huo zhe shi ftp,installer hui zi dong xia zai dao ben di 。 wen jian yi ban shi yong gzip da bao , qi zhong yao bao kuo yi ge package.xml wen jian , yong yu miao shu ni de zhe ge mo kuai de xiang guan xin xi , ru bao han de wen jian , xiang hu yi lai xing deng , ci wai dang ran yao bao kuo ni de mo kuai de php wen jian 。pacakage.xml de DTD wen jian zai pear mu lu xia mian , ming zi shi package.dtd. <?php require_once "PEAR/Installer.php"; $installer = new PEAR_Installer; // an zhuang zhi ding de mo kuai $result = $installer->install($package_file); if ( PEAR::isError($result)){ echo "Install $package_file failed!"; }else { echo "Install $package_file sucess!"; } ?> 2.CMD sui ran da duo shu de php ying yong hen shao tiao yong xi tong ming ling , yin wei zhe xie ying yong dou shi ji yu web de , cong yun xing xiao lv he xi tong de fu zai kao lv , dou yao bi mian zhi jie tiao yong xi tong ming ling , bu guo , zai you xie te shu de ying yong huo zhe shi ni yuan yi ba php zuo wei yi ge shell gong ju de shi hou , tiao yong xian you de xi tong gong ju jiu shi bu ke bi mian de le 。CMD ke yi rang ni hen fang bian di zhi xing yi xi lie de xi tong ming ling 。 shi yong yu fa :setOption ($option, $setting) she zhi shen shu $options wei $setting $options shi yi ge chang liang , ta ke yi shi yi xia zhi : CMD_SHUTDOWN : tong guo shutdown han shu lai zhi xing ming ling CMD_SHELL : zhi ding shell de lu jing CMD_OUTPUT : shi fou ping bi ming ling de biao zhun shu chu CMD_NOHUP : shi yong nohup hou tai zhi xing ming ling CMD_VERBOSE : jiang cuo wu da yin dao biao zhun shu chu command($command) tian jia xu yao zhi xing de ming ling ,$command ke yi shi shu zu huo pu tong de zi fu chuan exec() zhi xing yi jing tian jia de ming ling <?php require_once "CMD.php"; $cmd = new CMD; $cmd->command('tar zcvf test.tar.gz ~/test'); if ( $cmd->exec() ) { echo "success!\n"; } esle { echo "Error:" . $cmd->lastError; } ?> 3.Benchmark/Timer he Benchmark/Iterate zhe 2 ge mo kuai ke yi rang ni ce shi ni de dai ma de yun xing xiao lv ru he , wo ren wei zhe dui yu xi tong tiao shi hen you yong : ni ke yi chang shi bu tong de suan fa , zai xi kao cha mei zhong suan fa xu yao yun xing de shi jian , ran hou xuan ze zui jia de fang shi 。Benchmark/Timer ce shi yun xing zhong zai 2 ge bu tong de shi jian dian de shi jian cha ,Benchmark/Iterate ze shi dui Timer kuo zhan , ce shi yun xing mou duan dai ma ( han shu )n ci suo xu yao de shi jian 。 shi yong yu fa :Benchmark/Timer Timer::setMarker($name) she zhi dang qian shi jian dian wei $name Timer::start() kai shi ce shi Timer::stop() ting zhi ce shi Timer::timeElapsed($start = 'Start', $end = 'Stop') ji suan $start he $end zhe 2 ge shi jian dian de shi jian cha Timer::getProfiling() fan hui start he stop zhi jian suo hao yong de shi jian <?php require_once "Benchmark/Timer.php"; $timer = new Benchmark_Timer; $timer->start(); $timer->setMarker('Marker 1'); $timer->stop(); $profiling = $timer->getProfiling(); ?> Benchmark/Iterate Iterate::run() xun huan yun xing zhi ding de han shu 。 zhe shi yi ge ju you ke bian shen shu de fang fa , di yi ge shen shu shi yao xun huan de ci shu , di 2 ge shen shu shi yao zhi xing de han shu , di 3 ge shen shu qi ze shi yao chuan di gei ce shi han shu de shen shu 。 Iterate::get() fan hui ce shi suo yong de shi jian <?php require_once "Benchmark/Iterate.php"; $benchmark = new Benchmark_Iterate; function foo($string) { print $string." "; } $benchmark->run(100, 'foo', 'test'); $result = $benchmark->get(); ?> 3.File/Find &glob ($pattern, $dirpath, $pattern_type='php') zai $dirpath zhong sou suo fu he $pattern de mu lu he wen jian , fan hui pi pei de wen jian he mu lu ming shu zu &search ($pattern, $directory, $type='php') zai $directory zhong sou suo fu he $pattern gui ze de wen jian , fan hui pi pei de wen jian ming shu zu ( zhu yi , zhi shi wen jian , bu bao kuo zi mu lu )。$pattern shi yao zhi ding de sou suo tiao jian , yi ban shi gui ze biao da shi ,$patten_type zhi ding shi yong shen me mo shi de gui ze biao da shi , que sheng shi php mo shi , ni ye ke yi zhi ding "perl" lai shi yong perl mo shi de gui ze biao da shi ti shi :search he glob bu tong de shi ,glob bing bu di gui sou suo zi mu lu , er search ze di gui sou suo zi mu lu 。 <?php require_once "File/Find.php"; $find = new File_Find; // sou suo dang qian mu lu $php_files = $find->glob("*php","."); if ( PEAR::isError( $php_files ) ){ die " cuo wu :" . $php_files->getMessage() ."\n" ; } // di gui sou suo dang qian mu lu $all_php_files = $find->search("*php","."); if ( PEAR::isError( $all_php_files ) ){ die " cuo wu :" . $php_files->getMessage() ."\n" ; } ?> 4.File/Passwd cao zong password ge shi de wen jian , lei si ru biao zhun de unix password,apache de .htppass,cvs de pserver password wen jian 。 cong xian you ban ben de dai ma lai kan , ta huan bu neng zhen zheng di yong lai wei hu zhe xie passwd wen jian ( bi ru bing bu zhi chi shadow)。 bu guo ni ke yi yong lai chuang jian lei si de mi ma wen jian , dang ran , an quan xing bu hui hen gao 。 shi yong fang fa : File_Passwd($file,$lock=0)---------- chuang jian dui xiang ,$file shi ni yao cao zuo de passwd wen jian ,$lock zhi ding shi fou yao yong flock dui wen jian shang suo 。 addUser($user,$pass,$cvsuser)---------- zeng jia yi ge yong hu ,$user,$pass fen bie shi yong hu ming he mi ma ,$cvsuser shi cvs yong hu de id modUser($user,$pass,$cvsuser)---------- xiu gai $user de mi ma wei $pass,$cvsuser shi cvs yong hu de id delUser($user)---------- shan chu zhi ding de yong hu $user verifyPassword($user,$pass)---------- jian yan yong hu mi ma close()---------- bao cun gang cai de xiu gai dao password wen jian , guan bi password wen jian , dui wen jian jie suo 。 5.File/SearchReplace zai wen jian zhong cha zhao he ti huan zi fu chuan shi yong fang fa :File_SearchReplace($find, $replace, $files, $directories = '', $include_subdir = 1, $ignore_lines = array()) sheng cheng bing she zhi dui xiang $find yao cha zhao de zi fu chuan , ke yi shi zi fu chuan huo gui ze biao da shi $replace yao ti huan cheng de zi fu chuan , ke yi shi zi fu chuan huo gui ze biao da shi $files zhi ding zai na xie wen jian zhong jin xing ti huan cao zuo , shu zu huo zhe shi yi "," fen ge de yi ge zi fu chuan $directories zhi ding zai na ge mu lu zhong cao zuo , ke xuan , shu zu huo zhe shi yi "," fen ge de yi ge zi fu chuan $include_subdir ru guo shi zai mu lu zhong cao zuo , zhi ding shi fou zai zi mu lu zhong di gui zhi xing shang shu cao zuo , ke yi shi shu zhi 1 huo 0。 $ignore_lines zhi ding yao hu lue de wen jian xing , zhe shi yi ge shu zu , ren he yi zhe ge shu zu zhong ren yi yi ge zi fu chuan kai shi de wen jian xing , dou hui hu lue 。 getNumOccurences() fan hui yi jing zhi xing le cha zhao ti huan de ci shu getLastError() fan hui shang yi ci de cuo wu xin xi setFind($find) she zhi yao cha zhao de zi fu chuan setReplace($replace) she zhi yao ti huan de zi fu chuan setFiles($files) she zhi yao zhi xing ti huan cao zuo de wen jian setDirectories($directories) she zhi yao ti huan cao zuo de mu lu setIncludeSubdir($include_subdir) she zhi shi fou zai zi mu lu zhong ye zhi xing cha zhao ti huan setIgnoreLines($ignore_lines) she zhi yao hu lue de xing , zhi neng zai shi yong "normal" sou suo han shu de shi hou shi yong setSearchFunction($search_function) she zhi yao shi yong de sou suo han shu , ke yi shi xia lie shen shu : normal que sheng zhi , shi yong file han shu du ru wen jian nei rong , ran hou shi yong str_replace zhu xing de jin xing ti huan 。 quick shi yong str_replace zhi jie dui zheng ge wen jian jin xing ti huan preg shi yong preg_replace() lai jin xing ti huan , ni ke yi shi yong fu he zhe ge han shu yao qiu de gui ze biao da shi ereg shi yong ereg_replace() lai jin xing ti huan , ni ke yi shi yong fu he zhe ge han shu yao qiu de gui ze biao da shi doSearch() zhi xing cha zhao ti huan cao zuo <?php require_once "File/SearchReplace.php"; require_once "File/Find"; // di gui sou suo dang qian mu lu $find = new File_Find; $all_php_files = $find->search("*php","."); if ( PEAR::isError( $all_php_files ) ){ die " cuo wu :" . $php_files->getMessage() ."\n" ; } if ( !count($all_php_file) ){ die "NO php source files found!\n"; } // jiang <? de php biao zhi xiu zheng cheng <?php, yi fu he pear biao zhun $replace = new File_SearchReplace('<? ','<?php ',$all_php_files); $replace->doSearch(); if ( $replace->getLastError() ) { die " fa sheng cuo wu :" . $replace->getLastError() ; } else { echo " gong cheng gong ti huan le " . $replace->getNumOccurences() . " chu 。\n"; } ?> 6.HTML/Form zhe ge mo kuai ke yi rang ni kuai su di sheng cheng yi ge ti jiao de chuang ti , er wu xu chong xin qu bian xie html dai ma shi yong fang fa :Form::HTML_Form($action, $method = 'GET', $name = '', $target = '') zhe ge lei de gou zao han shu dai you yi xie shen shu , zhe xie shen shu he tong chang yao bian xie html dai ma zhong de form shen shu shi ji ben yi zhi de ,$action shi zai form zhong yao ti jiao dao de URL,$name ke yi zhi ding form de ming zi ,$target zhi ding shi fou yao xin kai chuang kou deng deng 。 xia mian de addXXX xi lie fang fa , yong yu zai zhe ge form zhong tian jia xiang ying de kong jian , kong jian de shu xing he html zhong de ye xiang yi zhi 。 addText($name, $title, $default, $size = HTML_FORM_TEXT_SIZE) addCheckbox($name, $title, $default) addTextarea($name, $title, $default,$width = HTML_FORM_TEXTAREA_WT,$height = HTML_FORM_TEXTAREA_HT) addPassword($name, $title, $default, $size = HTML_FORM_PASSWD_SIZE) addSubmit($name = "submit", $title = "Submit Changes") addReset($title = "Discard Changes") addSelect($name, $title, $entries, $default = '', $size = 1,$blank = '', $multiple = false, $attribs = '') addRadio($name, $title, $value, $default) addImage($name, $src) addHidden($name, $value) Display() xian shi zhe ge chuang ti <?php require_once "HTML/Form.php"; // chuang jian bing xian shi deng lu chuang ti $myform = new HTML_Form("./login.php"); $myform->addText('username',' yong hu ming ',''); $myform->addPasswd('passwd',' deng lu mi ma ',20); $myform->addHidden('retry','1'); $myform->addSumit('login',' deng lu '); $myform->Display(); ?> 7.Mail/RFC822 jian cha yi ge shu ru de email shi fou he fa , bu shi yi jian hen qing song de shi qing , ni ye xu chang shi shi yong yi xie gui ze biao da shi lai jian cha , dan shi bing fei na me fang bian you xiao 。 xian zai , ru guo yao jian cha yi xi lie de you jian di zhi shi fou fu he RFC822 biao zhun , bing ba ta men chai fen cheng dan du de email di zhi , ni ke yi shi shi zhe ge mo kuai , fei chang jian dan shi yong 。 shi yong fang fa :Mail_RFC822($address = null, $default_domain = null, $nest_groups = null, $validate = null) lei gou zao han shu ,$address shi ni yao yan zheng de yi xi lie de di zhi ,$default_domain, zhi ding que sheng de yu ming huo zhe zhu ji ming ,$nest_groups shi fou zai shu chu jie guo zhong jin xing fen zu , yi bian xian shi $validate shi fou xu yao yan zheng mei ge yuan zi parseAddressList($address = null, $default_domain = null, $nest_groups = null, $validate = null) fen xi yan zheng suo gei ding de di zhi lie biao , ru guo di zhi you xiao , fan hui chai fen hou de dan du de di zhi lie biao , ru guo fa sheng cuo wu , ze fan hui cuo wu xin xi 。 <?php require_once "Mail/RFC822.php"; $rf822 = new Mail_RFC822; $result=$rf822->paseAddressList('who;whoim@hotmail.com;test@test.ch'); if ( $rf822->error ){ echo "Error:$result"; }else { reset($result); for ($i=0; $i< count($result);$i++){ echo "email:$result[$i]\n"; } } ?> 8.Mail/Sendmail sendmail shi unix/linux shang mian zui chang yong de MTA, zhe ge mo kuai ke yi rang ni zhi jie shi yong sendmail lai fa song xin jian shi yong fang fa :Mail_sendmail($params) lei gou zao han shu ,$params shi yi ge guan lian shu zu , ni ke yi she ding sendmail de shen shu , mu qian zhi you 'sendmail_path' shi you xiao de , yong lai she zhi sendmail de lu jing send($recipients, $headers, $body) fa song xin jian ,$recipients shi ni de shou jian ren de email di zhi , ke yi shi dan ge , ye ke yi shi yong ; ge kai de di zhi lie biao , zhi yao fu he RFC82 biao zhun jiu ke yi 。$headers shi ni fa song xin jian de xin tou , zhe shi yi ge guan lian shu zu , shu zu de guan jian zi shi xin tou de ming zi ( ru Subject), shu zu zhi ze shi xin tou de zhi ( bi ru :Hello!)。 chu li hou de xin tou jiang hui shi :Subject:Hello! $body shi xin jian de xin ti , bao kuo suo you de MIME bian ma hou de bu fen 。 ru guo cheng gong , fan hui zhen , fou ze fan hui yi ge PEAR_Error dui xiang <?php require_once "Mail/sendmail.php"; $sendmail = new Mail_sendmail(array('sendmail_path=>'/usr/local/bin/sendmail')); $header = array('Subject'=>'Hello','BCC'=>'test2@hotmail.com'); $body = 'This is a test message from nightsailer.com'; $result = $sendmail->send([url=mailto:]'test@nightsailer.com'[/url], $header, $body); if ( PEAR::isError($result) ){ echo "<h1> fa song shi bai </h1><br> yuan yin :".$result->getMessage()."<br>"; }else { echo "<h1> gong xi ! fa song cheng gong !</h1><br>"; } ?> 9.Mail/smtp dui yu xian zai you xie zhan dian bu yuan xu shi yong sendmail, na me ru guo ni de php cheng xu xi wang shi yong fa xin gong neng , jiu xu yao neng gou tong guo shi yong wai bu de smtp fu wu qi lai wan cheng xiang ying de gong neng le 。 shi yong fang fa : shi yong shang zhe ge mo kuai he Mail::sendmail ji ben shang shi yi yang de 。 xu yao zhu yi de shi : zhe ge mo kuai xu yao shi yong Net::SMTP mo kuai :Mail_smtp($params) $params de you xiao shen shu shi : 'host' smtp de fu wu qi di zhi , que sheng shi localhost 'port' smtp fu wu duan kou , que sheng shi 25 'auth' smtp shi fou xu yao shou quan yan zheng , que sheng shi false 'usename' smtp shou quan de yong hu ming 'password' smtp shou quan de mi ma send($recipients, $headers, $body) fa song <?php require_once "Mail/sendmail.php"; $params=array('host'=>'smtp.nightsailer.com','auth'=true, 'username'=>'night','password'=>'123456'); $sendmail = new Mail_sendmail($params); $header = array('Subject'=>'Hello','BCC'=>'test2@hotmail.com'); $body = 'This is a test message from nightsailer.com'; $result = $sendmail->send([url=mailto:]'test@nightsailer.com'[/url], $header, $body); if ( PEAR::isError($result) ){ echo "<h1> fa song shi bai </h1><br> yuan yin :".$result->getMessage()."<br>"; }else { echo "<h1> gong xi ! fa song cheng gong !</h1><br>"; } ?> 10.Schedule/At zhe ge mo kuai ti gong le unix shang mian de at cheng xu de jie kou add($cmd, $timespec, $queue = false, $mail = false ) zhui jia yi ge at ming ling zhe ge fang fa jiang wei at cheng xu sheng cheng yi ge ding zhi de zuo ye : $cmd shi ni yao yun xing de cheng xu huo jiao ben $timespec shi zuo ye kai shi zhi xing de shi jian , ge shi yu at yao qiu de xiang tong $queue ke xuan shen shu , zhi ming zuo ye de dui lie ming $mail ke xuan shen shu , zhi ming shi fou zai zuo ye jie shu hou yao fa song email hui bao yun xing jie guo show($queue = false) xian shi zai at dui lie zhong de ming ling , fan hui yi ge guan lian shu zu , shu zu de key shi zuo ye de bian hao , xiang ying de jian zhi ye shi yi ge guan lian shu zu , nei rong shi array(runtime,queue)$queue shi yi ge ke xuan shen shu , ni ke yi yong ta xian ding zhi fan hui dui lie zhong dui lie ming pi pei $queue de zuo ye lie biao remove($job = false) cong at dui lie zhong shan chu zhi ding de at zuo ye $job shi yao shan chu de zuo ye bian hao , ru guo , cheng gong , fan hui true, fou ze fan hui false <?php require_once "Schedule/At.php"; $at = new Schedule_At(); // sheng cheng bing zhui jia yi ge zuo ye $result = $at->add ('find / -type file -name core -exec rm -f {} \;','00:00'); if ( PEAR::is_Error($result) ) { echo " wu fa zhui jia zuo ye !\n"; echo " yuan yin :$result->getMessage() \n"; exit; } // xian shi dang qian at dui lie $queue = $at->show(); if ( PEAR::isError($queue) ) { echo " fa sheng cuo wu !\n"; echo " yuan yin :" . queue->getMessage(). "\n"; exit; } reset( $queue ); while ( list($job, $cmd) = each $queue ){ echo "[$job]" . $cmd['runtime'] . "-" .$cmd['queue']; echo "\n" } ?> yi shang shi yi xie PEAR mo kuai de shi yong , geng wei xiang xi de shuo ming xu yao ni zi ji qu cha kan zhe xie mo kuai de yuan wen jian , huo zhe ni ke yi shi yong phpdoc zi dong sheng cheng zhe xie mo kuai de api wen dang 。 guan yu phpdoc, wo men jiang zai xia pian xiang xi tao lun 。 si 、 zi yuan PEAR CVS ni ke yi cong zhe li huo de zui xin de PEAR yuan ma Hoder xiang mu PHPDoc zhu ye
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
时尚性感的燕子(3)
时尚性感的燕子(2)
纯美的女生生活写真(14)
纯美的女生生活写真(13)
来自束河[]
恰巧-巧家~~
高尔夫
行摄匆匆天子山
 
>>返回首页<<
 为你推荐
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有