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 秀中文字串問題 | 豬窩
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
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
php substr 秀中文字串問題 | 豬窩
Awesome! Its truly awesome post, I have got much clear idea on the topic of from this piece of
writing.
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!
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!