<?PHP
$checked = "";
$function = $this->user_model->system_uri_data();
$sql = "select group_id,uri,allow from auth
where group_id ='2' and allow = true";
$query = $this->db->query($sql);
$j=0;
foreach ($function as $row) {
$j++;
foreach ($query->result() as $rowuri) {
$uri = $rowuri->uri;
if($row == $uri){
  $checked = "checked";
else {
  $checked = "";
}
}
   
if($j%5==0){
    echo ' <input type="checkbox" name ="function[]" value="'.$row.'" '.$checked.'">'.$row." <br />";
} else {
    echo ' <input type="checkbox" name ="function[]" value="'.$row.'" '.$checked.'">';
}
          }
?>
解决了 红色不要加蓝色