header("Content-type: text/html; charset=utf-8");
/**
* å°å符串转æ¢æäºè¿å¶
* @param type $str
* @return type
*/
function StrToBin($str){
//1.ååºæ¯ä¸ªå符
$arr = preg_split('/(?
//2.unpackå符
foreach($arr as &$v){
$temp = unpack('H*', $v); $v = base_convert($temp[1], 16, 2);
unset($temp);
}
return join(' ',$arr);
}
/**
* 讲äºè¿å¶è½¬æ¢æå符串
* @par
温馨提示:答案为网友推荐,仅供参考