将数组从控制器传递到视图而不使用模型

时间:2018-01-09 14:02:36

标签: codeigniter-3

我编写了从控制器访问数组的代码。但我无法访问视图中的数据。 代码如下。

<?php
public function Student(){
   $exam_no_students = array();
   $exam_centers['no_of_centers']= $this->DB1->count_centers();
   $exam_centers1= $this->DB1->count_centers();
   foreach ($exam_centers1 as $center_code => $center_details){
      $center_code = array('center_id' =>$center_details->center_id);
      $center_table='exam_center';
      $center_full_details =$this->DB1->getArrayWhereResult($center_table,$center_code);
      foreach ($center_full_details as $full => $full_de) {
           $fullstudent = array('center_f_id' =>$full_de->center_id,
                     'center_f_name' =>$full_de->exam_center,
                     'center_f_addres' =>$full_de->exam_center_address ,
                     'center_f_city' =>$full_de->village ,
                     'center_f_count' =>$center_details->count);
                      }
          array_push($exam_no_students, $fullstudent);                  
    }
   }
}

$abcd['assignment']=$exam_no_students;                      
$this->load->view('dissa');
$this->load->view('dissa',$abcd);

我无法在视图中访问变量分配

  

消息:试图获取非对象的属性请给我建议。

感谢。

0 个答案:

没有答案