PHP base64_decode乱码要怎么弄啊?
比如说我现在要decode下面的字符串
$code = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA88pPKPqRTcVGKcVNrphzUtq9hs1eSgyO/+g9DEfOVeeHlhaEhnYPabBJkpCayg3wTUKkBIWF5iPbPKKQp5zzdcWyvUXRcrHPzW77zm7HeraPT+YpXJlHjOdhERrGWKglvZmcVbcBLTr8mOlH3JjWmRf51G+LKPjT3OhVcJqCPwF+gC5CggyYiuiVN2OtvVjt2Tb2cxrjtVLbRCKTBq+4EpabkkEzWmurWLtrFT2N2ANDRDtfTmSpeQdHlzenlbWOFk8r3ty3/UiAP4HY53o1pvj5zDo5vZwHe25aoFHxSEJ3q/8H1OlCjbdeEeyTXA8IBqO5tNYRutS++8HlerZ4rQIDAQAB';
$tests=base64_decode($code);
var_dump( $tests );
输出后是:
有没有大神告诉我这个咋弄啊
回复讨论(解决方案)
显然他还做了某种处理
这要看是什么项目的数据了
显然他还做了某种处理
这要看是什么项目的数据了
$mod='d61df77df0b16df298c4e87e0f281ff5262684e486c4b495f23997ec7c81bb8a70c7ed314a667b0f098bb608a967db6be4a820e1b9960accebd2360654ef1825e8198e1d957e9e280c151bb01163066809e732c200cb0e9c61ca6567e25efa208bf3629dec0e29a89d96433107c26c7c29a6e4a12a4dd4b8a2b89a61ef3f3267';
$exp='010001';
$key=base64_encode ( hex2bin ( "30819f300d06092a864886f70d010101050003818d0030818902818100{$mod}0203{$exp}" ) );
$tests=base64_decode($key);
var_dump( $tests );$tests=base64_decode($key);
var_dump( $tests );
输出内容是:
hex2bin
为什么要用到hex2bin函数
把十六进制值转换为 ASCII 字符?
显然他还做了某种处理
这要看是什么项目的数据了
$mod='d61df77df0b16df298c4e87e0f281ff5262684e486c4b495f23997ec7c81bb8a70c7ed314a667b0f098bb608a967db6be4a820e1b9960accebd2360654ef1825e8198e1d957e9e280c151bb01163066809e732c200cb0e9c61ca6567e25efa208bf3629dec0e29a89d96433107c26c7c29a6e4a12a4dd4b8a2b89a61ef3f3267';
$exp='010001';
$key=base64_encode ( hex2bin ( "30819f300d06092a864886f70d010101050003818d0030818902818100{$mod}0203{$exp}" ) );
$tests=base64_decode($key);
var_dump( $tests );$tests=base64_decode($key);
var_dump( $tests );
输出内容是:
确定是hex2bin 而不是bin2hex?
这就不知道你们要讨论什么问题了
正因为数据中有不可打印的字符,所以才使用了 base64 编码进行交换
要想知道数据的真实含义,至少需要看程序是怎么使用它的
感谢大家,问题我已经解决了,通过hex2bin转码后是显示不出来的,我做这个主要是关于JAVA和PHP的RSA的验签问题,由JAVA端使用ras签名后,传给PHP端做验签,由于PHP只能使用openssl生成的pem文件来做验签,而java端只给出了一串1024位的16进制的公钥字符串,弄了好久了,昨天晚上才弄好。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.
