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 秀中文字串問題 | 豬窩

Do you mind if I quote a couple of your posts as
long as I provide credit and sources back to your weblog? My blog is in the very same niche as yours and my users would truly benefit from a
lot of the information you present here. Please let me know if this
alright with you. Appreciate it!

作者 website hosting companies @ 19:51, 2020-08-06

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

There's definately a great deal to know about this issue.
I really like all of the points you've made.

作者 web hosting service @ 18:51, 2020-08-07

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

Its like you read my mind! You appear to know so much approximately this, like you wrote the
guide in it or something. I think that you simply could
do with a few % to power the message home a little bit, however instead of that, this is fantastic blog.
A fantastic read. I will certainly be back.

作者 website hosting services @ 22:57, 2020-08-07

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

It's a shame you don't have a donate button! I'd without a
doubt donate to this fantastic blog! I guess for now i'll settle
for book-marking and adding your RSS feed to my Google account.
I look forward to new updates and will share this website with my Facebook group.
Chat soon!

作者 best web hosting 2020 @ 23:45, 2020-08-11

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

I know this if off topic but I'm looking into starting my own weblog and was wondering what
all is needed to get set up? I'm assuming having a
blog like yours would cost a pretty penny? I'm not very
internet smart so I'm not 100% sure. Any recommendations
or advice would be greatly appreciated. Kudos

作者 best web hosting sites @ 17:43, 2020-08-14
發表迴響
 authimage