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

Thanks for a marvelous posting! I genuinely enjoyed reading it, you might be a
great author. I will be sure to bookmark your blog
and will come back later on. I want to encourage you continue your great writing, have a nice holiday weekend!

作者 https://tinyurl.com/rsacwgxy g @ 06:09, 2020-06-22

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

Cbd oil that works 2020
Just desire to say your article is as astounding. The clearness
for your publish is simply great and i can assume you are knowledgeable on this subject.
Fine with your permission allow me to take hold of your RSS feed to keep updated with
drawing close post. Thanks a million and please keep up the rewarding work.
best rated cbd oil http://t.co/4kPhN7Ek0L cbd oil that works
2020 http://t.co/4kPhN7Ek0L

作者 http://t.co/4kPhN7Ek0L @ 16:59, 2020-06-24

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

Everything published was actually very reasonable. But, what about this?
suppose you were to create a awesome post title? I ain't suggesting your content isn't good, however what if you added
a title to possibly get a person's attention? I mean php substr
秀中文字串問題 | 豬窩 is a little plain. You
ought to look at Yahoo's home page and see how they create news titles to
grab people interested. You might add a related video or a
pic or two to grab readers excited about what you've
written. Just my opinion, it would make your posts a little
livelier.

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

Hello there I am so grateful I found your webpage, I really found you by error, while I was researching on Aol for something else, Regardless I am here now and would just
like to say many thanks for a remarkable post and a all round
entertaining blog (I also love the theme/design), I
don’t have time to browse it all at the moment but I have bookmarked it and also added
in your RSS feeds, so when I have time I will be back to read a lot
more, Please do keep up the superb b.

作者 tinyurl.com @ 16:02, 2020-06-26

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

Good info. Lucky me I found your website by accident (stumbleupon).
I have book-marked it for later!

作者 www.qhnbld.com @ 08:35, 2020-06-27
1 2 3 4 5  下一篇»
發表迴響
 authimage