php substr 秀中文字串問題
在用 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!
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
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.
php substr 秀中文字串問題 | 豬窩
Good info. Lucky me I found your website by accident (stumbleupon).
I have book-marked it for later!