質問する
2930 次
1 に答える
6
Instead of substr
use mbstring
functions:
echo anchor(
'projects/' . $rs->url_project_title . '/' . $rs->project_id,
mb_substr(ucfirst($rs->project_title), 0, 26),
'style="text-decoration:none;"'
);
If You are not successful with this, then it is possible that PHP didn't detect the string encoding and therefore please provide the right encoding to the mb_substr()
:
// PHP uses internal encoding mb_internal_encoding()
echo mb_substr($string, 0, 26);
// you specify the encoding - in the case you know in which encoding the input comes
echo mb_substr($string, 0, 26, 'UTF-8');
// PHP tries to detect the encoding
echo mb_substr($string, 0, 26, mb_detect_encoding($string));
See mb_detect_encoding()
as well for further information.
Hope this helps.
于 2012-06-07T15:30:48.997 に答える