| 
 | 
 
 
 楼主 |
发表于 2008-11-7 12:56:31
|
显示全部楼层
 
 
 
class Blog extends Controller{ 
          function Blog() 
                  { 
                     parent::Controller(); 
             $this->load->helper('url'); 
                         $this->load->database(); 
                         mysql_query("set names gb2312"); 
              } 
      function index() 
          { 
                 
                    echo anchor('blog/comments', 'Click Here'); 
            echo "这是我的博客"; 
          } 
          function hello() 
        { 
                  echo "hello,world"; 
          } 
          function error() 
        { 
                  echo "出错了,找不到你请求的页面!"; 
          } 
          function _dispermission() 
        { 
                  echo "Access Denided!"; 
          } 
          function view_date() 
          { 
           $query = $this->db->query('SELECT * FROM demo_node'); 
                   echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cn" lang="cn">'; 
                  echo "<meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">"; 
           foreach($query->result_array() as $row) 
                   { 
                      echo $row['id'].'<br>'; 
                          echo $row['name'].'<br>'; 
                          echo $row['title'].'<br>'; 
                          echo $row['remark'].'<br>'; 
                   } 
                   echo '</html>'; 
          } 
           
        /*  function _remap($method) 
        { 
                  if($method=='hello') 
                { 
                          $this->hello(); 
                  } 
                  else 
                { 
                          $this->error(); 
                  } 
          }*/ 
 
 
郁闷。我连接数据库后,mysql_query("set names gb2312");就正常了,难道CI不会自动转换嘛,,, |   
 
 
 
 |