Ms7 Search
Google 搜尋 翻譯
calendar
« 九月 2024 »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
近期文章
文章分類
網站連結
Syndicate

« | »

php substr 秀中文字串問題

2010-08-12 @ 18:48 in PHP, JavaScript, Sql

在用 substr 秀中文字串時,常常因為 big5用 2 byte , utf8 用 3 byte,不知如何切,今天在網上找到方法,改用 mb_substr 就可以,需計算字數用mb_strlen

例如: 

mb_substr($content,0,15,"UTF-8");  mb_substr($content,0,15,"BIG-5");

mb_strlen($content,"UTF-8");  mb_strlen($content,"BIG-5");

參考:

http://blog.xuite.net/chenbruse/bruse/13351768

http://ms7.fhsh.tp.edu.tw/php5c/ref.mbstring.html

 

 

迴響

php substr 秀中文字串問題 | 豬窩

I want to to thank you for this very good read!!
I certainly loved every little bit of it. I have you bookmarked to check out new
things you post…

作者 cbd oil that works 2020 @ 23:43, 2020-06-27

php substr 秀中文字串問題 | 豬窩

Hey! I know this is kind of off topic but I was wondering which blog
platform are you using for this website? I'm getting sick and
tired of Wordpress because I've had issues with hackers and I'm looking at alternatives for another platform.
I would be fantastic if you could point me in the direction of a good platform.

作者 cbd oil that works 2020 @ 11:41, 2020-06-28

php substr 秀中文字串問題 | 豬窩

Right here is the perfect blog for anybody who really wants to find
out about this topic. You know a whole lot its almost tough to argue with
you (not that I personally would want to…HaHa). You certainly
put a brand new spin on a subject which has been discussed for years.
Great stuff, just great!

作者 cbd oil that works 2020 @ 17:53, 2020-06-29

php substr 秀中文字串問題 | 豬窩

After looking into a handful of the blog articles on your website, I
honestly appreciate your way of blogging. I added it to my bookmark webpage list and will be checking back soon. Take a look
at my web site too and tell me what you think.

作者 webhosting @ 21:02, 2020-07-16

php substr 秀中文字串問題 | 豬窩

Its like you learn my mind! You appear to know a lot about this, such
as you wrote the book in it or something. I think that you simply can do with some % to force the message house a little bit,
but instead of that, that is fantastic blog.
An excellent read. I'll certainly be back.

作者 website hosting companies @ 13:19, 2020-07-18
發表迴響
 authimage