<sub id="xjhft"><dfn id="xjhft"><mark id="xjhft"></mark></dfn></sub>

<noframes id="xjhft">
<address id="xjhft"><listing id="xjhft"><menuitem id="xjhft"></menuitem></listing></address>
    <em id="xjhft"><form id="xjhft"></form></em>
<noframes id="xjhft">
      <noframes id="xjhft">

              您現在的位置: 首頁 > 新聞 > 建站常識

              destoon改造MIP文章內容img正則替換mip-img方法

              來源:網絡公司發布時間:2021-04-26熱度:28836

               

              首先第一步,找到你修改的模塊,我以資訊模塊為例:

              路徑為:/module/article/show.inc.php

              然后打開,大概在18行左右 插入一下代碼,進行正則替換


              function mip_replace($content = ''){
              $pattern1 = "#<img.*?src=['\"](.*?)['\"].*?>#ims";
              $imgcontent=array();
              preg_match_all($pattern1,$content,$img);
              $imgcontent = $img[0];
              $imgurl = $img[1];
              foreach($imgcontent as $imgk=>$imgv)
              {
              $temp =  str_replace('<img','mip-img',$imgv);
              $temp = str_replace('/>','></mip-img',$temp);
              $url = $imgurl[$imgk];
              $url = mip_format_img_url($url);
              $temp = preg_replace("/src=['\"].*?['\"]/si","src=http://www.computadoradeescritorio.com/skin/mall/image/nopic.gif>
              $mipimg[$imgk] = $temp;
              }
              $content = preg_replace($imgcontent,$mipimg,$content);
              $content =preg_replace("/<a /si","<a target=\"_blank\" ",$content);
              $content =preg_replace("/style=\".*?\"/si","",$content);
              return mip_utf8($content);
              }
              function mip_format_img_url( $url = ''){
              if(stripos($url, 'http') === 0 || stripos($url, 'ftp') === 0 ){
              return $url;
              }
              if(stripos($url, '/') === 0){
              $url = 'http://'.$_SERVER['HTTP_HOST'].$url;
              }else{
              $url = 'http://'.$_SERVER['HTTP_HOST'].'/'.$url;
              }
              return $url;
              }
              function mip_utf8($string = '') {
              $fileType = mb_detect_encoding($string , array('UTF-8','GBK','LATIN1','BIG5'));
              if( $fileType != 'UTF-8'){
              $string = mb_convert_encoding($string ,'utf-8' , $fileType);
              }
              return $string;
              }
              $content=mip_replace($content);

              本文來源:http://www.computadoradeescritorio.com/news/show-1642.html
              少妇让我帮她高潮

              <sub id="xjhft"><dfn id="xjhft"><mark id="xjhft"></mark></dfn></sub>

              <noframes id="xjhft">
              <address id="xjhft"><listing id="xjhft"><menuitem id="xjhft"></menuitem></listing></address>
                <em id="xjhft"><form id="xjhft"></form></em>
              <noframes id="xjhft">
                  <noframes id="xjhft">