C# to PHP base64 encode/decode
程序员文章站
2022-05-06 19:30:45
...
We should probably URL Encode your Base64 string on the C# side before you send it.
And URL Decode it on the php side prior to base64 decoding it.
C# side
byte[] encbuff = System.Text.Encoding.UTF8.GetBytes("the string");
string enc = Convert.ToBase64String(encbuff);
string urlenc = Server.UrlEncode(enc);
and php side:
$data = $_REQUEST['in'];
$decdata = urldecode($data);
$raw = base64_decode($decdata);
下一篇: 浅析PHP函数extract()应用技巧
推荐阅读
-
PHP保存Base64图片base64_decode的问题整理
-
php中json_decode()和json_encode()的使用方法
-
浅析PHP中json_encode与json_decode的区别
-
PHP保存Base64图片base64_decode的问题及解决办法
-
浅析php中json_encode()和json_decode()
-
php中base64_decode与base64_encode加密解密函数实例
-
php中对内置函数json_encode和json_decode的异常处理
-
certutil - decode/encode BASE64/HEX strings.Print symbols by HEX code
-
MD5加密字符串并转化为base64(C#和PHP代码相同实现)
-
PHP session_encode()和 session_decode()