当我尝试向数组添加值时,它只会为我输出数组,
function getAllRoles($format='ids')
{
$format = strtolower($format);
$query = $this->db->prepare("SELECT * FROM roles");
$query->execute();
$resp = array();
foreach ($query as $row){
if ($format == 'full'){
$resp[] = array("ID"=>$row['ID'],"Name"=>$row['roleName']);
}else{
$resp[] = $row['ID'];
}
}
return $resp;
}
要获取我输入的数组,
echo "<br>getAllRoles: ".$Secure->getAllRoles("full");