How do I implement hex2bin()?

后端 未结 8 1825
野趣味
野趣味 2020-11-29 02:40

I need to communicate between Javascript and PHP (I use jQuery for AJAX), but the output of the PHP script may contain binary data. That\'s why I use bin2hex()

8条回答
  •  抹茶落季
    2020-11-29 03:30

    If someone needs the other direction (bin to hex), here is it:

    function bin2hex(bin) {
        return new Buffer(bin).toString("hex");
    }
    

提交回复
热议问题