久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何實現(xiàn)將字符串轉(zhuǎn)為ASCII

      php實現(xiàn)將字符串轉(zhuǎn)為ASCII的方法:【public function strtoascii($str{ $str=mb_convert_encoding($str,'GB2312');$change_after='';for(…】。

      php如何實現(xiàn)將字符串轉(zhuǎn)為ASCII

      本文操作環(huán)境:windows10系統(tǒng)、php 7、thinkpad t480電腦。

      字符串與ASCII之間的轉(zhuǎn)換:

      下面的函數(shù)是已經(jīng)封裝好的,可以直接拿來使用。

      1、將字符串(中文同樣實用)轉(zhuǎn)為ascii(注意:我默認當前我們的php文件環(huán)境是UTF-8,如果是GBK的話mb_convert_encoding操作就不需要)

      public function strtoascii($str){         $str=mb_convert_encoding($str,'GB2312');         $change_after='';         for($i=0;$i<strlen($str);$i++){             $temp_str=dechex(ord($str[$i]));             $change_after.=$temp_str[1].$temp_str[0];         }         return strtoupper($change_after);     }

      2、將ascii轉(zhuǎn)為字符串(中文同樣實用)(注意:我默認當前我們的php文件環(huán)境是UTF-8,如果是GBK的話mb_convert_encoding操作就不需要)

      public function asciitostr($sacii){         $asc_arr= str_split(strtolower($sacii),2);         $str='';         for($i=0;$i<count($asc_arr);$i++){             $str.=chr(hexdec($asc_arr[$i][1].$asc_arr[$i][0]));         }         return mb_convert_encoding($str,'UTF-8','GB2312');     }

      推薦學習:php培訓

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號