补充,两个php文件都是utf-8的格式

解决方案 »

  1.   

    class CTest
    {
        private $m_str;
        public function SetData($data)
        {
            $this->m_str=$data;
        }
        public function GetData()
        {
            return $this->m_str;
        }
    }
      

  2.   

    还是不行啊,输出如下:Begin test 
    锘緾ould you get this data?
      

  3.   

    请检查$data的编码与页面编码是否一致。
      

  4.   

    如果我把  $p->SetData("Could you get this data?"); 这句里的字符串修改成中文,更是乱码
      

  5.   

    检查了页面,是简体中文的,修改成UTF-8就可以了,怎么可以避免这个问题呢?
      

  6.   


    你的两个文件编码不一致,统一改成UTF-8。
      

  7.   

    <?php header(“Content-Type: text/html; charset=utf-8"); // 是这样设置吗?提示错误 echo "Begin test <br>";
    require_once './tt.php';
    $p=new CTest();
    $p->SetData("Could you see this string?");
    $str=$p->GetData();
    echo $str;
    ?>