| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> php >> yong PHP shi xian POP3 you jian de jie ma ( er )

yong PHP shi xian POP3 you jian de jie ma ( er )

2008-12-23 08:12:50 编辑來源:互联网 评论
 
 
 
本文为【用PHP实现POP3邮件的解码(二)】的拼音翻译版
  MIME bian ma fang shi jian jie
  Subject: =?gb2312?B?xOO6w6Oh?=
  zhe li shi you jian de zhu ti , ke shi yin wei bian ma le , wo men kan bu chu shi shen me nei rong , qi yuan lai de wen ben shi :“ ni hao !” wo men xian kan kan MIME bian ma de liang zhong fang fa 。
  dui you jian jin xing bian ma zui chu de yuan yin shi yin wei Internet shang de hen duo wang guan bu neng zheng que chuan shu 8 bit nei ma de zi fu , bi ru han zi deng 。 bian ma de yuan li jiu shi ba 8 bit de nei rong zhuan huan cheng 7 bit de xing shi yi neng zheng que chuan shu , zai jie shou fang shou dao zhi hou , zai jiang qi huan yuan cheng 8 bit de nei rong 。
  MIME shi “ duo yong tu wang ji you jian kuo chong xie yi ” de suo xie , zai MIME xie yi zhi qian , you jian de bian ma zeng jing you guo UUENCODE deng bian ma fang shi , dan shi you yu MIME xie yi suan fa jian dan , bing qie yi yu kuo zhan , xian zai yi jing cheng wei you jian bian ma fang shi de zhu liu , bu jin shi yong lai chuan shu 8 bit de zi fu , ye ke yi yong lai chuan song er jin zhi de wen jian , ru you jian fu jian zhong de tu xiang 、 yin pin deng xin xi , er qie kuo zhan le hen duo ji yu MIME de ying yong 。 cong bian ma fang shi lai shuo ,MIME ding yi le liang zhong bian ma fang fa Base64 yu QP(Quote-Printable) :
  Base 64 shi yi zhong tong yong de fang fa , qi yuan li hen jian dan , jiu shi ba san ge Byte de shu ju yong 4 ge Byte biao shi , zhe yang , zhe si ge Byte zhong , shi ji yong dao de dou zhi you qian mian 6 bit, zhe yang jiu bu cun zai zhi neng chuan shu 7bit de zi fu de wen ti le 。Base 64 de suo xie yi ban shi “B”, xiang zhe feng xin zhong de Subject jiu shi yong de Base64 bian ma 。
  ling yi zhong fang fa shi QP(Quote-Printable) fang fa , tong chang suo xie wei “Q” fang fa , qi yuan li shi ba yi ge 8 bit de zi fu yong liang ge 16 jin zhi shu zhi biao shi , ran hou zai qian mian jia “=”。 suo yi wo men kan dao jing guo QP bian ma hou de wen jian tong chang shi zhe ge yang zi :=B3=C2=BF=A1=C7=E5=A3=AC=C4=FA=BA=C3=A3=A1。
  zai PHP li , xi tong you liang ge han shu ke yi hen fang bian di shi xian jie ma :base64_decode() yu quoted_printable_decode(), qian zhe ke yong yu base64 bian ma de jie ma , hou zhe shi yong yu QP bian ma fang fa de jie ma 。
  xian zai wo men zai lai kan kan Subject: =?gb2312?B?xOO6w6Oh?= zhe yi zhu ti de nei rong , zhe bu shi yi duan wan zheng de bian ma , zhi you bu fen shi bian ma le de , zhe ge bu fen yong =? ?= liang ge biao ji kuo qi lai ,=? hou mian shuo ming de shi zhe duan wen zi de zi fu ji shi GB2312 , ran hou yi ge ? hou mian de yi ge B biao shi de shi yong de Base64 bian ma 。 tong guo zhe duan fen xi , wo men lai kan yi xia zhe ge MIME jie ma de han shu :( gai han shu you PHPX.COM zhan chang Sadly ti gong , ben ren jiang qi fang ru yi ge lei zhong , bing zuo le shao liang de xiu gai , zai ci zhi xie )
  function decode_mime($string) {
  $pos = strpos($string, '=?');
  if (!is_int($pos)) {
  return $string;
  }
  $preceding = substr($string, 0, $pos); // save any preceding text
  $search = substr($string, $pos+2); /* the mime header spec says this is the longest a single encoded word can be */
  $d1 = strpos($search, '?');
  if (!is_int($d1)) {
  return $string;
  }
  $charset = substr($string, $pos+2, $d1); // qu chu zi fu ji de ding yi bu fen
  $search = substr($search, $d1+1); // zi fu ji ding yi yi hou de bu fen =>$search;
  $d2 = strpos($search, '?');
  if (!is_int($d2)) {
  return $string;
  }
  $encoding = substr($search, 0, $d2); //// liang ge ? zhi jian de bu fen bian ma fang shi :q huo b
  $search = substr($search, $d2+1);
  $end = strpos($search, '?='); //$d2+1 yu $end zhi jian shi bian ma le de nei rong :=> $endcoded_text;
  if (!is_int($end)) {
  return $string;
  }
  $encoded_text = substr($search, 0, $end);
  $rest = substr($string, (strlen($preceding . $charset . $encoding . $encoded_text)+6)); //+6 shi qian mian qu diao de =????= liu ge zi fu
  switch ($encoding) {
  case 'Q':
  case 'q':
  //$encoded_text = str_replace('_', '%20', $encoded_text);
  //$encoded_text = str_replace('=', '%', $encoded_text);
  //$decoded = urldecode($encoded_text);
  $decoded=quoted_printable_decode($encoded_text);
  if (strtolower($charset) == 'windows-1251') {
  $decoded = convert_cyr_string($decoded, 'w', 'k');
  }
  break;
  case 'B':
  case 'b':
  $decoded = base64_decode($encoded_text);
  if (strtolower($charset) == 'windows-1251') {
  $decoded = convert_cyr_string($decoded, 'w', 'k');
  }
  break;
  default:
  $decoded = '=?' . $charset . '?' . $encoding . '?' . $encoded_text . '?=';
  break;
  }
  return $preceding . $decoded . $this->decode_mime($rest);
  }
  zhe ge han shu yong le di gui de fang fa lai shi xian yi duan bao han you ru shang de Subject duan de zi fu de jie ma 。 cheng xu zhong yi jing jia shang le zhu shi 。 xiang xin you dian PHP bian cheng ji chu de ren dou neng gou kan de ming bai 。 gai han shu ye shi tiao yong de base64_decode() yu quoted_printable_decode() liang ge xi tong han shu shi xian de jie ma , dan shi xu yao dui you jian yuan wen jian jin xing da liang de zi fu chuan de fen xi 。 bu guo ,PHP de zi fu chuan cao zuo ke yi suan shi suo you yu yan li zui wei fang bian zi you de 。 han shu de zui hou return $preceding . $decoded . $this->decode_mime($rest); shi xian di gui jie ma , yin wei zhe ge han shu shi ji shang shi fang zai hou mian yao jie shao de yi ge MIME jie ma de lei zhong de , suo yi yong le $this->decode_mime($rest) zhe zhong xing shi de tiao yong fang fa 。
  xia mian wo men lai kan zheng wen 。 zhe li guan xi dao MIME de yi xie tou xin xi , wo men xian zuo yi ge jian dan de jie shao ( ru guo du zhe you xing qu le jie geng duo de nei rong , qing shen kao MIME de guan fang wen dang )。
  MIME-Version: 1.0
  biao shi shi yong de MIME de ban ben hao , yi ban shi 1.0;
  Content-Type: ding yi le zheng wen de lei xing , wo men shi ji shang shi tong guo zhe ge biao shi lai zhi dao zheng wen nei shi shen me lei xing de wen jian , bi ru :
  text/plain biao shi de shi wu ge shi de wen ben zheng wen ,
  text/html biao shi de Html wen dang ,
  image/gif biao shi de shi gif ge shi de tu pian deng deng 。
  zai ben wen zhong te bie yao shuo ming yi xia de shi you jian zhong chang yong dao de fu he lei xing 。multipart lei xing biao shi zheng wen shi you duo ge bu fen zu cheng de , hou mian de zi lei xing shuo ming de shi zhe xie bu fen zhi jian de guan xi , you jian zhong yong dao de san ge lei xing you ,
  multipart/alternative: biao shi zheng wen you liang ge bu fen zu cheng , ke yi xuan ze qi zhong de ren yi yi ge 。 zhu yao zuo yong shi zai zheng wen tong shi you text ge shi he html ge shi shi , ke yi zai liang ge zheng wen zhong xuan ze yi ge lai xian shi , zhi chi html ge shi de you jian ke hu duan ruan jian yi ban hui xian shi qi HTML zheng wen , er bu zhi chi de ze hui xian shi qi Text zheng wen ;
  multipart/mixed : biao shi wen dang de duo ge bu fen shi hun he de , zhi zheng wen yu fu jian de guan xi 。 ru guo you jian de MIME lei xing shi
  multipart/mixed, ji biao shi you jian dai you fu jian ;
  multipart/related : biao shi wen dang de duo ge bu fen shi xiang guan de , yi ban yong lai miao shu Html zheng wen yu qi xiang guan de tu pian 。
  zhe xie fu he lei xing you shi ke yi qian tao shi yong de , bi ru shuo yi ge dai you fu jian de you jian , tong shi you html yu text liang zhong ge shi de zheng wen , ze you jian de jie gou shi :
  Content-Type: multipart/mixed
  bu fen yi :
  Content Type : multipart/alternative:
  Text zheng wen ;
  Html ge shi de zheng wen
  bu fen er :
  fu jian
  you jian jie shu fu ;
  you yu fu he lei xing you duo ge bu fen zu cheng , yin ci , xu yao yi ge fen ge fu lai fen ge zhe duo ge bu fen , zhe jiu shi shang mian de you jian yuan wen jian zhong de boundary="----=_NextPart_000_0007_01C03166.5B1E9510" suo miao shu de , dui yu mei yi ge Contect type :multipart/* de nei rong , dou hui you zhe me yi ge shuo ming , biao shi duo ge bu fen zhi jian de fen ge , zhe ge fen ge fu shi zheng wen zhong bu ke neng chu xian de yi chuan gu zi fu de zu he , zai wen dang zhong , yi "--" jia shang zhe ge boundary lai biao shi yi ge bu fen de kai shi , zai wen dang de jie shu , yi "--" jia boundary zai zai zui hou jia shang "--" lai biao shi wen dang de jie shu 。 you yu fu he lei xing shi ke yi qian tao shi yong de , yin ci , you jian zhong ke neng hui duo ge boundary。
  huan you yi ge zui chong yao de MIME tou biao qian :
  Content-Transfer-Encoding: base64 ta biao shi le zhe ge bu fen wen dang de bian ma fang shi , ye jiu shi wo men shang mian suo jie shao de Base64 huo QP(Quote-Printable)。 wo men zhi you shi bie le zhe ge shuo ming , cai neng yong zheng que de jie ma fang shi shi xian dui qi jie ma 。
  xian yu pian fu , dui yu MIME de jie shao jiu zhi shuo dao zhe li 。 xia mian wo jiang gei chu yi ge jie ma MIME you jian de lei , bing dui qi zuo jian yao shuo ming 。【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

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

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

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

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

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

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

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

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

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

 
 
MIME bian ma fang shi jian jie   Subject: =?gb2312?B?xOO6w6Oh?=    zhe li shi you jian de zhu ti , ke shi yin wei bian ma le , wo men kan bu chu shi shen me nei rong , qi yuan lai de wen ben shi :“ ni hao !” wo men xian kan kan MIME bian ma de liang zhong fang fa 。    dui you jian jin xing bian ma zui chu de yuan yin shi yin wei Internet shang de hen duo wang guan bu neng zheng que chuan shu 8 bit nei ma de zi fu , bi ru han zi deng 。 bian ma de yuan li jiu shi ba 8 bit de nei rong zhuan huan cheng 7 bit de xing shi yi neng zheng que chuan shu , zai jie shou fang shou dao zhi hou , zai jiang qi huan yuan cheng 8 bit de nei rong 。   MIME shi “ duo yong tu wang ji you jian kuo chong xie yi ” de suo xie , zai MIME xie yi zhi qian , you jian de bian ma zeng jing you guo UUENCODE deng bian ma fang shi , dan shi you yu MIME xie yi suan fa jian dan , bing qie yi yu kuo zhan , xian zai yi jing cheng wei you jian bian ma fang shi de zhu liu , bu jin shi yong lai chuan shu 8 bit de zi fu , ye ke yi yong lai chuan song er jin zhi de wen jian , ru you jian fu jian zhong de tu xiang 、 yin pin deng xin xi , er qie kuo zhan le hen duo ji yu MIME de ying yong 。 cong bian ma fang shi lai shuo ,MIME ding yi le liang zhong bian ma fang fa Base64 yu QP(Quote-Printable) :   Base 64 shi yi zhong tong yong de fang fa , qi yuan li hen jian dan , jiu shi ba san ge Byte de shu ju yong 4 ge Byte biao shi , zhe yang , zhe si ge Byte zhong , shi ji yong dao de dou zhi you qian mian 6 bit, zhe yang jiu bu cun zai zhi neng chuan shu 7bit de zi fu de wen ti le 。Base 64 de suo xie yi ban shi “B”, xiang zhe feng xin zhong de Subject jiu shi yong de Base64 bian ma 。    ling yi zhong fang fa shi QP(Quote-Printable) fang fa , tong chang suo xie wei “Q” fang fa , qi yuan li shi ba yi ge 8 bit de zi fu yong liang ge 16 jin zhi shu zhi biao shi , ran hou zai qian mian jia “=”。 suo yi wo men kan dao jing guo QP bian ma hou de wen jian tong chang shi zhe ge yang zi :=B3=C2=BF=A1=C7=E5=A3=AC=C4=FA=BA=C3=A3=A1。    zai PHP li , xi tong you liang ge han shu ke yi hen fang bian di shi xian jie ma :base64_decode() yu quoted_printable_decode(), qian zhe ke yong yu base64 bian ma de jie ma , hou zhe shi yong yu QP bian ma fang fa de jie ma 。    xian zai wo men zai lai kan kan Subject: =?gb2312?B?xOO6w6Oh?= zhe yi zhu ti de nei rong , zhe bu shi yi duan wan zheng de bian ma , zhi you bu fen shi bian ma le de , zhe ge bu fen yong =? ?= liang ge biao ji kuo qi lai ,=? hou mian shuo ming de shi zhe duan wen zi de zi fu ji shi GB2312 , ran hou yi ge ? hou mian de yi ge B biao shi de shi yong de Base64 bian ma 。 tong guo zhe duan fen xi , wo men lai kan yi xia zhe ge MIME jie ma de han shu :( gai han shu you PHPX.COM zhan chang Sadly ti gong , ben ren jiang qi fang ru yi ge lei zhong , bing zuo le shao liang de xiu gai , zai ci zhi xie )   function decode_mime($string) {    $pos = strpos($string, '=?');    if (!is_int($pos)) {      return $string;    }    $preceding = substr($string, 0, $pos); // save any preceding text    $search = substr($string, $pos+2); /* the mime header spec says this is the longest a single encoded word can be */    $d1 = strpos($search, '?');    if (!is_int($d1)) {      return $string;    }    $charset = substr($string, $pos+2, $d1); // qu chu zi fu ji de ding yi bu fen    $search = substr($search, $d1+1); // zi fu ji ding yi yi hou de bu fen =>$search;    $d2 = strpos($search, '?');    if (!is_int($d2)) {      return $string;    }    $encoding = substr($search, 0, $d2); //// liang ge ?  zhi jian de bu fen bian ma fang shi  :q  huo  b     $search = substr($search, $d2+1);    $end = strpos($search, '?='); //$d2+1 yu $end zhi jian shi bian ma le   de nei rong :=> $endcoded_text;    if (!is_int($end)) {      return $string;    }    $encoded_text = substr($search, 0, $end);    $rest = substr($string, (strlen($preceding . $charset . $encoding . $encoded_text)+6)); //+6 shi qian mian qu diao de  =????=  liu ge zi fu    switch ($encoding) {    case 'Q':    case 'q':      //$encoded_text = str_replace('_', '%20', $encoded_text);      //$encoded_text = str_replace('=', '%', $encoded_text);      //$decoded = urldecode($encoded_text);    $decoded=quoted_printable_decode($encoded_text);      if (strtolower($charset) == 'windows-1251') {      $decoded = convert_cyr_string($decoded, 'w', 'k');      }      break;    case 'B':    case 'b':      $decoded = base64_decode($encoded_text);      if (strtolower($charset) == 'windows-1251') {      $decoded = convert_cyr_string($decoded, 'w', 'k');      }      break;    default:      $decoded = '=?' . $charset . '?' . $encoding . '?' . $encoded_text . '?=';      break;    }    return $preceding . $decoded . $this->decode_mime($rest);   }    zhe ge han shu yong le di gui de fang fa lai shi xian yi duan bao han you ru shang de Subject duan de zi fu de jie ma 。 cheng xu zhong yi jing jia shang le zhu shi 。 xiang xin you dian PHP bian cheng ji chu de ren dou neng gou kan de ming bai 。 gai han shu ye shi tiao yong de base64_decode() yu quoted_printable_decode() liang ge xi tong han shu shi xian de jie ma , dan shi xu yao dui you jian yuan wen jian jin xing da liang de zi fu chuan de fen xi 。 bu guo ,PHP de zi fu chuan cao zuo ke yi suan shi suo you yu yan li zui wei fang bian zi you de 。 han shu de zui hou return $preceding . $decoded . $this->decode_mime($rest); shi xian di gui jie ma , yin wei zhe ge han shu shi ji shang shi fang zai hou mian yao jie shao de yi ge MIME jie ma de lei zhong de , suo yi yong le $this->decode_mime($rest) zhe zhong xing shi de tiao yong fang fa 。    xia mian wo men lai kan zheng wen 。 zhe li guan xi dao MIME de yi xie tou xin xi , wo men xian zuo yi ge jian dan de jie shao ( ru guo du zhe you xing qu le jie geng duo de nei rong , qing shen kao MIME de guan fang wen dang )。   MIME-Version: 1.0    biao shi shi yong de MIME de ban ben hao , yi ban shi 1.0;   Content-Type: ding yi le zheng wen de lei xing , wo men shi ji shang shi tong guo zhe ge biao shi lai zhi dao zheng wen nei shi shen me lei xing de wen jian , bi ru : text/plain biao shi de shi wu ge shi de wen ben zheng wen , text/html biao shi de Html wen dang , image/gif biao shi de shi gif ge shi de tu pian deng deng 。    zai ben wen zhong te bie yao shuo ming yi xia de shi you jian zhong chang yong dao de fu he lei xing 。multipart lei xing biao shi zheng wen shi you duo ge bu fen zu cheng de , hou mian de zi lei xing shuo ming de shi zhe xie bu fen zhi jian de guan xi , you jian zhong yong dao de san ge lei xing you , multipart/alternative: biao shi zheng wen you liang ge bu fen zu cheng , ke yi xuan ze qi zhong de ren yi yi ge 。 zhu yao zuo yong shi zai zheng wen tong shi you text ge shi he html ge shi shi , ke yi zai liang ge zheng wen zhong xuan ze yi ge lai xian shi , zhi chi html ge shi de you jian ke hu duan ruan jian yi ban hui xian shi qi HTML zheng wen , er bu zhi chi de ze hui xian shi qi Text zheng wen ; multipart/mixed : biao shi wen dang de duo ge bu fen shi hun he de , zhi zheng wen yu fu jian de guan xi 。 ru guo you jian de MIME lei xing shi multipart/mixed, ji biao shi you jian dai you fu jian ; multipart/related : biao shi wen dang de duo ge bu fen shi xiang guan de , yi ban yong lai miao shu Html zheng wen yu qi xiang guan de tu pian 。    zhe xie fu he lei xing you shi ke yi qian tao shi yong de , bi ru shuo yi ge dai you fu jian de you jian , tong shi you html yu text liang zhong ge shi de zheng wen , ze you jian de jie gou shi :   Content-Type: multipart/mixed    bu fen yi :    Content Type : multipart/alternative:    Text zheng wen ;    Html ge shi de zheng wen      bu fen er :    fu jian    you jian jie shu fu ;    you yu fu he lei xing you duo ge bu fen zu cheng , yin ci , xu yao yi ge fen ge fu lai fen ge zhe duo ge bu fen , zhe jiu shi shang mian de you jian yuan wen jian zhong de boundary="----=_NextPart_000_0007_01C03166.5B1E9510" suo miao shu de , dui yu mei yi ge Contect type :multipart/* de nei rong , dou hui you zhe me yi ge shuo ming , biao shi duo ge bu fen zhi jian de fen ge , zhe ge fen ge fu shi zheng wen zhong bu ke neng chu xian de yi chuan gu zi fu de zu he , zai wen dang zhong , yi  "--" jia shang zhe ge boundary lai biao shi yi ge bu fen de kai shi , zai wen dang de jie shu , yi "--" jia boundary zai zai zui hou jia shang "--" lai biao shi wen dang de jie shu 。 you yu fu he lei xing shi ke yi qian tao shi yong de , yin ci , you jian zhong ke neng hui duo ge  boundary 。    huan you yi ge zui chong yao de MIME tou biao qian :   Content-Transfer-Encoding: base64 ta biao shi le zhe ge bu fen wen dang de bian ma fang shi , ye jiu shi wo men shang mian suo jie shao de Base64 huo QP(Quote-Printable)。 wo men zhi you shi bie le zhe ge shuo ming , cai neng yong zheng que de jie ma fang shi shi xian dui qi jie ma 。   xian yu pian fu , dui yu MIME de jie shao jiu zhi shuo dao zhe li 。 xia mian wo jiang gei chu yi ge jie ma MIME you jian de lei , bing dui qi zuo jian yao shuo ming 。
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
玉美人_珠联璧合
清纯美女米卡
清新靓丽的早晨
玲子的自信与性感
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有