Home > Backend Development > PHP Tutorial > 二进制数据转十进制字符串

二进制数据转十进制字符串

WBOY
Release: 2016-06-13 13:16:56
Original
2089 people have browsed it

二进制数据转十进制字符串求助
我有一串Base64后的数据解开后是二进制的数据,求助怎么把这串二进制数据转换成十进制然后以字符串形式输出呢? 我试过bindec()这个函数转 ,但是得到的是0. 很费解啊 其他进制转换函数也试过了,但是好像都不行啊.

一下是我Base64原数据
V3FwMbiBTiYKVBXgO68BwSRWUXQETmISFVKmKWb2P7bgn/b49neYqikxbO8l9ZsnZ2hqHauZXEHMDmj5wKCXd59bSLmidYwdAojwUMNt4Uh3DkRa+PTAViKCYyUfrj1lmuE6pe5mI5ol/FwwZGn6Z1OTYlDo8BZLrYHhl2FKyW8=

------解决方案--------------------

PHP code
$data = base64_decode('V3FwMbiBTiYKVBXgO68BwSRWUXQETmISFVKmKWb2P7bgn/b49neYqikxbO8l9ZsnZ2hqHauZXEHMDmj5wKCXd59bSLmidYwdAojwUMNt4Uh3DkRa+PTAViKCYyUfrj1lmuE6pe5mI5ol/FwwZGn6Z1OTYlDo8BZLrYHhl2FKyW8=');
    
$t0 = current(unpack('H*',$data));
$t1 = "57717031b8814e260a5415e03baf01c124565174044e62121552a62966f63fb6e09ff6f8f67798aa29316cef25f59b2767686a1dab995c41cc0e68f9c0a097779f5b48b9a2758c1d0288f050c36de148770e445af8f4c056228263251fae3d659ae13aa5ee66239a25fc5c306469fa6753936250e8f0164bad81e197614ac96f";

var_dump($t0 == $t1); <div class="clear">
                 
              
              
        
            </div>
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template