Re: [請益] 物件導向的一個寫法

看板PHP作者 (邱老虎)時間15年前 (2010/08/31 17:21), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
怎不分開寫? 不知道以下這樣寫是不是你要的, 不過我個人不喜歡就是了... class grid { private $head_data; //標題列的資料 private $rows_data; //資料列的資料 public $head_html; public $body_html; public function create_grid($heads, $bodys){ $this->head_html = $heads; $this->body_html = $bodys; $html = $heads.$bodys; return $this; } public function get_head(){ return $this->head_html; } } 改了紅色部份 -- 惡 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.56.138.224
文章代碼(AID): #1CVCcILZ (PHP)
文章代碼(AID): #1CVCcILZ (PHP)