PHP中一个文件调用另一个文件类的方法,然后输出出现乱码,求解! 补充,两个php文件都是utf-8的格式 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 class CTest{ private $m_str; public function SetData($data) { $this->m_str=$data; } public function GetData() { return $this->m_str; }} 还是不行啊,输出如下:Begin test 锘緾ould you get this data? 请检查$data的编码与页面编码是否一致。 如果我把 $p->SetData("Could you get this data?"); 这句里的字符串修改成中文,更是乱码 检查了页面,是简体中文的,修改成UTF-8就可以了,怎么可以避免这个问题呢? 你的两个文件编码不一致,统一改成UTF-8。 <?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;?> linux下配置apahce和php file_get_contents取不到内容 请教显示结果为何这样? echo 语法 php替换内容方法求教。 页面在后退时提示过期,如何让它不再显示过期而直接显示页面。 求PHP取得系统信息的函数,CPU+内存使用+磁盘空间 请教,树形结构菜单节点权限判断的思路?当父节点不被允许,但因为子节点要求允许,父节点也必须强制允许显示,怎么进行这样的过滤判断? 在线等,下拉菜单的问题??? 退出登录之后如何返回当前页面。 这个出错是怎么回事? php查询这几行xml语言怎么做?网上代码太长了看不懂 php access以中文作为参数进行数据查询时出现乱码。
{
private $m_str;
public function SetData($data)
{
$this->m_str=$data;
}
public function GetData()
{
return $this->m_str;
}
}
锘緾ould you get this data?
你的两个文件编码不一致,统一改成UTF-8。
require_once './tt.php';
$p=new CTest();
$p->SetData("Could you see this string?");
$str=$p->GetData();
echo $str;
?>