<menu id="uuzns"><dd id="uuzns"></dd></menu>
  1. <big id="uuzns"></big>
    <mark id="uuzns"></mark>
      <meter id="uuzns"></meter>
    1. <td id="uuzns"><menuitem id="uuzns"><mark id="uuzns"></mark></menuitem></td>
      1. 辉煌电商SEO内测

        百度关键词优化三天上首页同行都是朋友 ?#38431;?#19968;起互利共赢谢绝一切非正规行业服务?#34892;?#20197;下同行团队?#25945;?#21644;代理的支持

        百度站长?#25945;MIP开发小组SEO焦大老友SEO每天一贴ZAC大哥卢松松大哥海瑶SEO兄弟附子SEO兄弟探索者SEO帮站SEO好友互点宝超快排?#25945;?

        百亿互刷宝下拉天下SEO自学网SEO研究中心小明SEO王德春SEO马海祥博客踏雪无痕?#19968;?#24037;作室SEO云优化好友云客网杭州思亿欧网赚吧北京SEO韩非老弟

        需要了解以上同?#23454;?#30456;关信息我们已经给你做好了搜索框看右上角绿色那个输入搜索即刻直达

        网站统计 共有读稿14437部 / 今日更新篇 / 评论19条 / 会员75 名 / 阅读1086085
        您好,请 登陆/注册
        软件内容页横幅广告

        PHP中文竖排转换实现方法

        2018.04.20

        浏览:

        导语如果您觉得本篇内容还不错请点击文章下面的赞然后分享给朋友哦...

        PHP中文竖排转换实现方法-破洛洛教学网...请看详情...

        seo

        seo

        PHP中文竖排转换程序文?#31350;?#36755;入文字转换后会竖排文字

        效果图

        PHP中文竖排转换实现方法

        index.php内容

        <?php 
        include('ccw.inc.php'); 
         
        if (isset($_POST['string'])){ 
         $ccw = new CCW; 
         $converd = $ccw->convert($_POST['string']); 
        } 
        ?> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <form method="post" charset="utf-8"> 
         <p><?php echo $converd ?></p> 
         <p><textarea name="string" cols="50" rows="10"></textarea></p> 
         <p><input type="submit" /></p> 
        </form> 
        

        ccw.inc.php文件内容

        <?php 
        /** 
         * 转换中文字符串至古文排版 
         */ 
        class CCW { 
         protected $SEPARATOR = ''; 
         protected $BLANK = ''; 
         protected $CHARLIST = array( 
         '0' => '', '1' => '', '2' => '', '3' => '', '4' => '', '5' => '', 
         '6' => '', '7' => '', '8' => '', '9' => '', 'a' => '', 'b' => '', 
         'c' => '', 'd' => '', 'e' => '', 'f' => '', 'g' => '', 'h' => '', 
         'i' => '', 'j' => '', 'k' => '', 'l' => '', 'm' => '', 'n' => '', 
         'o' => '', 'p' => '', 'q' => '', 'r' => '', 's' => '', 't' => '', 
         'u' => '', 'v' => '', 'w' => '', 'x' => '', 'y' => '', 'z' => '', 
         'A' => '', 'B' => '', 'C' => '', 'D' => '', 'E' => '', 'F' => '', 
         'G' => '', 'H' => '', 'I' => '', 'J' => '', 'K' => '', 'L' => '', 
         'M' => '', 'N' => '', 'O' => '', 'P' => '', 'Q' => '', 'R' => '', 
         'S' => '', 'T' => '', 'U' => '', 'V' => '', 'W' => '', 'X' => '', 
         'Y' => '', 'Z' => '', '(' => '', ')' => '', '[' => '', ']' => '', 
         '{' => '', '}' => '', '<' => '', '>' => '', '*' => '', '&' => '', 
         '^' => '', '%' => '', '$' => '', '#' => '', '@' => '', '!' => '', 
         '~' => '', '`' => '', '+' => '', '-' => '', '=' => '', '_' => '', 
         '|' => '', '\\' =>'', '\'' =>'', '"' => '', ';' => '', ':' => '', 
         '.' => '', ',' => '', '?' => '', '/' => '', ' ' => '', '' => '', 
         '' => '', '' => '', '' => '', '' => '', '' => '' 
         ); 
         
         public $height = 10; // 默认竖排高度 
         
         /** 
         * 转换文字到竖排 
         * 
         * @return string 
         */ 
         function convert($original, $height = null) { 
         $original = preg_replace('/\s/', '', $original); // 去除多余的空格等 
         $strarr = $this->mbStringToArray($original); // 分解成数组 
         $height = $height ? intval($height) : $this->height; 
         $total = sizeof($strarr); 
         $width = ceil($total / $height); 
         
         // 分割中文字符 
         $result = array(); 
         for ($i = 0, $tmp = array(); $i < $total; $i++) { 
         $c = $strarr[$i]; // 格式化当前字符 
         $tmp[] = isset($this->CHARLIST[$c]) ? $this->CHARLIST[$c] : $c; 
         if (sizeof($tmp) == $height) { 
         $result[] = $tmp; 
         $tmp = array(); 
         } 
         } 
         
         // 如果还有剩余的字符 
         if (sizeof($tmp)) { 
         $result[] = $tmp; 
         } 
         
         // 开始输出 
         $output = "<pre>"; 
         for($j = 0; $j < $height; $j++) { 
         for ($i = $width - 1; $i >= 0; $i--) { 
         $output .= $this->SEPARATOR; 
         $output .= isset($result[$i][$j]) ? $result[$i][$j] : $this->BLANK; 
         } 
         $output .= $this->SEPARATOR; 
         $output .= "\n"; 
         } 
         
         return $output."</pre>"; 
         } 
         
         
         /** 
         * 转换字符串至数组 
         */ 
         private function mbStringToArray ($string, $encoding = 'utf-8') { 
         while ($strlen = mb_strlen($string)) { 
         $array[] = mb_substr($string, 0, 1, $encoding); 
         $string = mb_substr($string, 1, $strlen, $encoding); 
         } 
         
         return $array; 
         } 
        } 
        ?> 

        以上就是php中文竖排转换的实现方法希望对大?#19994;?#23398;习有所帮助

        0
        赞一个
        关键词
        ?#19981;?#36825;篇文章吗分享给你的好友吧点击这里复制网址
        共有141人阅读期待你的评论评论
        请先登陆后才能发表评论哦没账号赶紧注册一个吧
        最新评论
        热门标签
        回到顶部
        ʱʱʹٷ

          <menu id="uuzns"><dd id="uuzns"></dd></menu>
        1. <big id="uuzns"></big>
          <mark id="uuzns"></mark>
            <meter id="uuzns"></meter>
          1. <td id="uuzns"><menuitem id="uuzns"><mark id="uuzns"></mark></menuitem></td>
              1. <menu id="uuzns"><dd id="uuzns"></dd></menu>
              2. <big id="uuzns"></big>
                <mark id="uuzns"></mark>
                  <meter id="uuzns"></meter>
                1. <td id="uuzns"><menuitem id="uuzns"><mark id="uuzns"></mark></menuitem></td>