這個結構將有幾個頁面,只有 foreach 或 while 只顯示最后一個結果,這個問題發(fā)生在我做了這個函數(shù)之后,我已經(jīng)看到了幾個問題,并且與 matriz 相關class Layout { private $sql, $row; private function set_layout($cond, $cond_r) { $this->sql = $this->select("*", "table", "".$cond."", array($cond_r)); foreach ($this->sql as $this->row) : return $this->row['name']; endforeach; } public function get_layout($cond, $cond_r) { return $this->set_layout($cond, $cond_r); }}echo $midia->get_layout("WHERE status != ? ORDER BY id DESC", 0);
1 回答

天涯盡頭無女友
TA貢獻1831條經(jīng)驗 獲得超9個贊
我不確定,但我認為您正在尋找類似的東西:
class Layout {
private $sql, $row;
private function set_layout($cond, $cond_r) {
$this->sql = $this->select("*", "table", "".$cond."", array($cond_r));
$rows = array();
foreach ($this->sql as $this->row) :
$rows[] = $this->row['name'];
endforeach;
return implode($rows); //Return array of rows AFTER loop
}
public function get_layout($cond, $cond_r) {
return $this->set_layout($cond, $cond_r);
}
}
echo $midia->get_layout("WHERE status != ? ORDER BY id DESC", 0);
- 1 回答
- 0 關注
- 139 瀏覽
添加回答
舉報
0/150
提交
取消