双引号转义,将文本内容中的双引号转义为单引号 ticket #142

This commit is contained in:
Li Jianxuan 2011-09-06 08:27:57 +00:00
parent 54c27d0dbf
commit 9d2a8f5b61
1 changed files with 1 additions and 1 deletions

View File

@ -210,7 +210,7 @@ class Admin_DownController extends Zend_Controller_Action
$sql="select * from offlineapp where ts_approved is not null and pdflink is not null order by ts_created desc"; $sql="select * from offlineapp where ts_approved is not null and pdflink is not null order by ts_created desc";
$rows=$this->db->fetchAll($sql); $rows=$this->db->fetchAll($sql);
foreach($rows as $row){ foreach($rows as $row){
$content.='"'.$row['username'].'","'.$row['unit'].'","'.$row['phone'].'","'.$row['address'].'","'.$row['postcoe'].'","'.$row['project'].'","'.$row['datalist'].'","'.$row['email'].'",'.$row['ts_approved']."\n"; $content.='"'.$row['username'].'","'.$row['unit'].'","'.$row['phone'].'","'.$row['address'].'","'.$row['postcoe'].'","'.str_replace("\"","'",$row['project']).'","'.str_replace("\"","'",$row['datalist']).'","'.$row['email'].'",'.$row['ts_approved']."\n";
} }
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream') $this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="offlineapp.csv"') ->setHeader('Content-Disposition','attachment; filename="offlineapp.csv"')