好的,所以我理解为什么这是打印,但我不希望它打印到页面,而是我需要这个来隐藏,并允许我只获取名称值
public function select($table,$options,$where,$orderby)
{
$options = empty($options) ? "*" : $options;
$where = empty($where) ? "1=1" : $where;
$orderby = empty($orderby) ? "" : $orderby;
$qry = "SELECT $options FROM $table WHERE $where $orderby ";
//print $qry;
$result = mysql_query($qry) or die(json_encode(array("error",mysql_error())));
while(($row = mysql_fetch_assoc($result))){ $resultArray[] = $row; }
return count($resultArray) < 1 ? print "[".json_encode(array("error"=>"sorry"))."]" : print json_encode($resultArray);
}
我在index.php页面上使用以下内容来获取此信息(使用其他函数)
$menu = json_decode($fetch->menu('1'));
foreach ( $menu as $json )
{
echo $json['name']."\n";
}