在这一行之后将数组传递给视图工作正常:foreach($rb_data as $row){<table>}?>但在我<body>上面的表格中我无法使用<h1><?php echo $rb_data['brand'];?></h1>
我收到的错误是Message: Undefined index: brand. 我尝试$data = array()在控制器中使用初始化数组,但这没有奏效。是否有其他方法可以初始化数组,以便在foreach语句之前使用它?谢谢你看看。控制器:
    public function community_single($rb){
        $data['rb_data'] =  $this->rootbeer_model->community_single($rb);
        $this->load->view('rb_community_single_view',$data);
    }
模型:
    public function community_single($rb){
        $this->rb_db->select('*');
        $this->rb_db->from('rb_selection');
        $this->rb_db->where('brand',$rb);
        $query = $this->rb_db->get();
        return $query->result_array();
    }