| 加入收藏| 设为首页| 联系我们
用php如何过滤16进制的字符串
http://www.domcn.org 文章来源:本站收藏 点击数:
/** * (字符串16进制编码/解码 ) * * @access public * @param string $string 需要进行编码解码的字串 * @return string */ function hexEncode($str=null){ return preg_replace(/(.)/es, str_pad(dechex(ord(\\1)),2,0,STR_PAD_LEFT), $str); } function hexDecode($str=null){ return preg_replace(/(\w{2})/e,chr(hexdec(\\1)),$str); }