Home > Backend Development > PHP Tutorial > C# 中 UTF8Encoding.UTF8.GetBytes(key),,对应PHP中的哪个方法? 怎么写?

C# 中 UTF8Encoding.UTF8.GetBytes(key),,对应PHP中的哪个方法? 怎么写?

WBOY
Release: 2016-06-20 12:46:03
Original
2224 people have browsed it

C# 中 UTF8Encoding.UTF8.GetBytes(key),,对应PHP中的哪个方法?
怎么写?


回复讨论(解决方案)

$s = '中文abc';$s = iconv('gbk', 'utf-8', $s); //不是 utf-8 时需转 utf-8print_r(unpack('C*', $s));
Copy after login
Copy after login
Array(    [1] => 228    [2] => 184    [3] => 173    [4] => 230    [5] => 150    [6] => 135    [7] => 97    [8] => 98    [9] => 99)
Copy after login
Copy after login
C#测试
            foreach (var c in UTF8Encoding.UTF8.GetBytes("中文abc"))            {                Console.WriteLine(c);            }
Copy after login
Copy after login

$s = '中文abc';$s = iconv('gbk', 'utf-8', $s); //不是 utf-8 时需转 utf-8print_r(unpack('C*', $s));
Copy after login
Copy after login
Array(    [1] => 228    [2] => 184    [3] => 173    [4] => 230    [5] => 150    [6] => 135    [7] => 97    [8] => 98    [9] => 99)
Copy after login
Copy after login
C#测试
            foreach (var c in UTF8Encoding.UTF8.GetBytes("中文abc"))            {                Console.WriteLine(c);            }
Copy after login
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