错误: The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol.
源文件:http://localhost/cmsutf8/29/core/Smarty-3.0.9/libs/plugins/function.get.php
行:0
php文件,数据库文件,html页面均为utf-8编码,源代码如下:
    <?php
    function smarty_function_get($params,$template){
    $must  = array('model','condition','var');
    $maybe = array('order'=>'id DESC','limit'=>'');
    foreach($must as $v){
    if(!array_key_exists($v,$params)){
      trigger_error("the var $v must be given",E_USER_NOTICE);
      exit;
    }
    }
    foreach($maybe as $k=>$v){
    if(!array_key_exists($k,$params)){
      $params[$k] = $v;
    }
    }
    $modelName = $params['model'].Model;
    $model     = new $modelName;
    $row = $model->getAll($params['condition'],$params['order'],$params['limit']);
    $template->assign($params['var'],$row);
    }
    ?>

解决方案 »

  1.   

    加上header("Content-Type: text/html; charset=utf-8");
    也不行
      

  2.   

    我想你那header()函数并没有设置成功。
    简单点的,HTML的meta设置了吗? 
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">这样就无须服务器端声明了
      

  3.   

    php输出头header("Content-Type: text/html; charset=utf-8"),静态页面添加<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 都加过了,还是不行 
      

  4.   

    把下面的
    $must  = array('model','condition','var');
    $maybe = array('order'=>'id DESC','limit'=>'');foreach($must as $v){
    if(!array_key_exists($v,$params)){
      trigger_error("the var $v must be given",E_USER_NOTICE);
      exit;
    }
    }foreach($maybe as $k=>$v){
    if(!array_key_exists($k,$params)){
      $params[$k] = $v;
    }
    }
    屏蔽就可以但那一段也没有错误啊