-5

http://sphotos-h.ak.fbcdn.net/hphotos-ak-prn2/v/1291812_726798364014050_1048588136_n.jpg?oh=a3d67e861bd9932a6a19e57819d2baa2&oe=5233F729&__gda__=1379199229_33f351e1d3876f61503ffe0097f059eb

我想查询数组为:

Array ( [0] => Array 
( [0] => Array ([cid] => 12 [sid] => 1 [category_name] => กาแฟ [mid] => 7 [menu_name] => เอสเพรสโซ่ (ร้อน) [price] => 50 )
 [1] => Array ( [cid] => 12 [sid] => 1 [category_name] => กาแฟ [mid] => 9 [menu_name] => มอคค่า (ร้อน) [price] => 50 )
)
 [1] =>Array ( [0]=> Array ( [cid] => 14 [sid] => 1 [category_name] => โกโก้ & ชา [mid] => 8 [menu_name] => โกโก้ (เย็น) [price] => 60 )

 ) 
4

1 回答 1

1

我不确定你的意思,但我相信你正试图从你的数组中获取数据以插入到 ui 选项卡中。这就是我在 MVC 中要做的事情:

看法:

<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>
<li class="tab" id=""><a href="#<?php echo $variable; ?>">Test</a></li>

控制器:

function expand_staff_info($staff_info) {
   $data = $this->Model_request->getData();
   $this->load->view('agents/view_staff_info', $data);
}

模型:

 function getData() {
  $array = array(..... YOUR ARRAY ......);
  $data;
   foreach ($array as $row) {
     foreach ($row as $key => $val) {
        $data[$key] = $val;
     }
   }
  return $data;
}
于 2013-09-12T18:49:04.163 回答