PHP中一个文件调用另一个文件类的步骤,然后输出出现乱码,求解

WBOY
Release: 2016-06-13 11:45:24
Original
960 people have browsed it

PHP中一个文件调用另一个文件类的方法,然后输出出现乱码,求解!
tt.php文件

<?php<br />class CTest<br />{<br />	private $m_str;<br />	public function SetData($data)<br />	{<br />		$m_str=$data;<br />	}<br />	public function GetData()<br />	{<br />		return $m_str;<br />	}<br />}<br />	<br />?>
Copy after login



文件test.php
<?php<br />	echo "Begin test <br>"; // 正常显示<br />	require_once './tt.php';<br />	$p=new CTest();<br />	$p->SetData("Could you get this data?");<br />	$str=$p->GetData();<br />	echo $str; // 无法正常显示<br />?>
Copy after login


------
在浏览器中显示test.php执行结果
Begin test



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template