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

Definitely believe that that you said. Your favourite justification seemed to be on the web the
simplest factor to keep in mind of. I say to you, I certainly get annoyed at the same time as
people think about worries that they just do not recognize about.
You controlled to hit the nail upon the top and defined out the whole thing with no
need side effect , people can take a signal. Will probably be again to get more.
Thank you

作者 content hosting @ 10:23, 2020-07-23

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

I'm curious to find out what blog system you're utilizing?
I'm having some small security issues with my latest site and
I would like to find something more risk-free. Do you have any solutions?

adreamoftrains web hosting service

作者 adreamoftrains best web hosting sites @ 21:50, 2020-07-30

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

Awesome! Its truly awesome post, I have got much clear idea on the topic of from this piece of
writing.

作者 skyscanner.com @ 12:53, 2020-07-31

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

I like the valuable information you provide in your articles.
I'll bookmark your weblog and check again here frequently.
I'm quite certain I'll learn many new stuff right here!

Best of luck for the next!

作者 web hosting providers @ 22:50, 2020-08-05

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

Great blog! Do you have any tips and hints for aspiring
writers? I'm hoping to start my own blog soon but
I'm a little lost on everything. Would you advise starting with
a free platform like Wordpress or go for a paid option? There are so many choices out there that I'm totally confused ..
Any recommendations? Thanks!

作者 web hosting reviews @ 18:08, 2020-08-06
發表迴響
 authimage