PHP怎么获得中文的ASCII码啊
Jun 23, 2016 pm 02:16 PM ASP中直接使用 asc("中") 就可以获得-10544
在PHP中使用ord('中')得到的是228
如何能像ASP那样获得中文的ASCII码啊
请高手帮忙
回复讨论(解决方案)
ASC() ANSI 字符代码
ASC() ANSI 字符代码
晕
只对gbk编码有效!
echo asc('中');function asc($s) { if(ord($s) < 128) return ord($s); return current(unpack('N', "\xff\xff$s"));}
只对gbk编码有效!
echo asc('中');function asc($s) { if(ord($s) < 128) return ord($s); return current(unpack('N', "\xff\xff$s"));}
非常感谢啊 UTF-8的用iconv转一下就可以了吧
对 utf-8 要转成 gbk 的才可以和 asp 中的一致
对 utf-8 要转成 gbk 的才可以和 asp 中的一致
非常感谢 虽然达到目的了 但是原理还是不知道 这太复杂了 需要好好专研一下 不然太闹心了 我先去结贴

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

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

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

6 Extra Skills Every PHP Developer Should Have

Simplified HTTP Response Mocking in Laravel Tests

Build a React App With a Laravel Back End: Part 2, React

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon
