陣列:
$ecodesAr = Array (
[0] => 1Z0-060
[1] => 98- 3752] => 98- 3683] => 98-367 )
for($k=0; $k<count($ecodesAr); $k ){
$arrayTB[$k] = $this-> Functions-> exam('title', $ecodesAr[$k]); }
模式化的代碼:
public function exam($q, $d) {
$q = $this->db->where($q, $d)
->得到('exams')。
return $q->row()。
}
結果:
Array (
[0] =>
[1] =>
[2] =>
[3] => stdClass Object ( [id] => 1091 [hot_exam] => 0 [top_exam] => 0 [category] => 114 [subcats] => 288 [slug] => 98367 [sku] => OI5Ao [標題] => 98-367 [name] => MTA安全基礎知識[更新]=> 2021-09-16 [regular_price] => 130 [sale_price] => 59 [on_homepage] => 0 [on_request] => 0 [expired] => 0 [path_slug] => 98367. pdf [question] => 123 [demo_slug] => 98-367-demo. pdf [prc_price] => 65 [prc_demo] => 98-367-demo [prc_exam] => 98-367 [is_active] => 1 )
)
輸出中跳過了前3個值,只得到了最后一個值,我想把所有的陣列資料與值對照,請大家幫忙!
uj5u.com熱心網友回復:
$productsarry = Array (
[0] => Milk
[1] => 奶油
[2] => 糖
[3] => Yougert
);
for($k = 0; $k < count($productsarry); $k ) {
$arrayTB[$k] = query("select slug, qty, name, price from exams where title ='$ecode'" /span>)-> row();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/328411.html
標籤:
