比如使用UTF-8,在filters.yml写上:
myUtf8ConnectionFilter:
class: myUtf8ConnectionFilter
activate: on
在app的lib目录添加一个myUtf8ConnectionFilter.class.php
- <?php
- class myUtf8ConnectionFilter extends sfFilter
- {
- public function execute($filterChain)
- {
- $con = Propel::getConnection();
- if ($con){
- $con->executeQuery("set names utf8");
- } else {
- throw new Exception($e);
- }
- $filterChain->execute();
- }
- }
- ?>