久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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字符串如何轉(zhuǎn)為16進(jìn)制字符串

      php字符串轉(zhuǎn)為16進(jìn)制的方法:首先創(chuàng)建一個(gè)PHP示例文件;然后通過String2Hex方法將字符串轉(zhuǎn)為16進(jìn)制;最后通過return返回轉(zhuǎn)換結(jié)果即可。

      php字符串如何轉(zhuǎn)為16進(jìn)制字符串

      推薦:《PHP視頻教程》

      php字符串和16進(jìn)制編碼的相互轉(zhuǎn)換

      php字符串是十進(jìn)制的

      /** **字符串轉(zhuǎn)16進(jìn)制 **/  public function String2Hex($string){         $hex='';         for ($i=0; $i < strlen($string); $i++){             $hex .= dechex(ord($string[$i]));         }         return $hex;     } /** **16進(jìn)制轉(zhuǎn)字符串 **/     public function Hex2String($hex){         $string='';         for ($i=0; $i < strlen($hex)-1; $i+=2){             $string .= chr(hexdec($hex[$i].$hex[$i+1]));         }         return $string;     } // example: $hex = String2Hex("test sentence..."); // $hex contains 746573742073656e74656e63652e2e2e echo Hex2String($hex); // outputs: test sentenc

      我在做aes加密是發(fā)現(xiàn)一個(gè)問題,發(fā)現(xiàn)將字符串轉(zhuǎn)16進(jìn)制會(huì)出現(xiàn)轉(zhuǎn)出數(shù)據(jù)位數(shù)對(duì)不上的問題可以修改為如下試試:

       public function String2Hex($string){         $hex=''; //        for ($i=0; $i < strlen($string); $i++){ //            $hex .= dechex(ord($string[$i])); //        }         $hex = bin2hex($string);         return $hex;     }

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