Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Js and php 16 hexadecimal string conversion problem, advanced, online and so on! ! !
Js and php 16 hexadecimal string conversion problem, advanced, online and so on! ! !
Function? Hex2bin (data)

var? Data? =? (data? ||? '')? +? '';

var? tmpStr? =? '';

if(data.length? %? 2){

Console? & amp& amp? console.warning('hex2bin():? Hexadecimal Input? String? Must? Really? Ann? Even? Length');

Return? Fake;

}

if(/[^\da-z]/ig.test(data)){

Console? & amp& amp? console.warning('hex2bin():? Input? String? Must? Is it? Hexadecimal string’);

Return? Fake;

}

for(var? Me? =? 0,? j? =? Data length; ? Me? & lt? j; ? Me? +=? 2){

tmpStr? +=? '%'? +? Data [i]? +? Data [me? +? 1];

}

Return? decodeURIComponent(tmp str);

}