在mb_substr添加UTF-8编码参数,让其不会出现乱码

This commit is contained in:
wlx 2010-06-27 02:36:31 +00:00
parent 6d887035db
commit 867b43c86f
1 changed files with 1 additions and 1 deletions

View File

@ -179,7 +179,7 @@ class WaterController extends DataController
foreach($rows as $row) { foreach($rows as $row) {
$timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).' GMT+0800" '; $timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).' GMT+0800" ';
if ($row['timeend']!='' && $row['timeend']!=$row['timebegin']) $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" isDuration="true"'; if ($row['timeend']!='' && $row['timeend']!=$row['timebegin']) $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" isDuration="true"';
$timexml.= ' title="'.htmlspecialchars(mb_substr($row['title'],31)).'" image="/images/westdc_40w.gif" link="/water/'.$row['uuid'].'">'; $timexml.= ' title="'.htmlspecialchars(mb_substr($row['title'],11,mb_strlen($row['title'],'UTF-8')-10,'UTF-8')).'" image="/images/westdc_40w.gif" link="/water/'.$row['uuid'].'">';
$desc_length=mb_strlen($row['description'],"UTF-8"); $desc_length=mb_strlen($row['description'],"UTF-8");
$desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8"); $desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
if ($desc_length>300) $desc.=" ..."; if ($desc_length>300) $desc.=" ...";