PHP类中自定义方法为什么返回不到数组啊 有代码
<?phpclass chaxun{
private $get;
private $db;
private $zhiduan;
function __construct($db,$zhiduan,$get){
$this->db=$db;
$this->zhiduan=$zhiduan;
$this->get=$get;
$conn=mysql_connect('localhost','root','');
mysql_select_db('dhf',$conn);
mysql_query("set names gbk");
$this->cha($rows);
}
function cha($rows){
if ($_POST[submit]){
echo $sql="select * from $this->db where $this->zhiduan like '%$this->get%'";
$query=mysql_query($sql);
$rows=mysql_fetch_array($query);
//$rows[content]=str_replace(" "," ",str_replace("\n","<br>",$rows[content]));
//$row[]=$rows;
return $rows;
}
}
}
$chaxun=new chaxun('message','content',$_POST[select]);
print_r($rows);
if(is_array($rows)){
echo "是";
}else{
echo "错误";
}
?>
<form method="post">
<input name="select">
<input type="submit" name="submit" value="查找">
</form>
类中cha()方法为什么返回不了$rows的值呢,但是我在类中直接用print_r打印的时候就可以,在外面怎么就不行了呢,就连is_array判断的时候都不是个数组,谁帮我看看错哪儿了