[請益] cakephp的資料集

看板PHP作者 (...)時間11年前 (2014/07/18 12:31), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
平常操作資料庫獲得的資料都是二維陣列:$rows[列數][欄位名] 例如,假設要獲取文章的資料,資料表叫 Post。常撈出來的結果像這樣 [0] => Array ( [id] => 1 [title] => First article [content] => aaa [created] => 2008-05-18 00:00:00 ) [1] => Array ( [id] => 2 [title] => Second article [content] => bbb [created] => 2008-05-18 00:00:00 ) 但是 cakephp 會在中間多一層,把資料表名稱放進去: [0] => Array ( [Post] => Array ( [id] => 1 [title] => First article [content] => aaa [created] => 2008-05-18 00:00:00 ) ) [1] => Array ( [Post] => Array ( [id] => 2 [title] => Second article [content] => bbb [created] => 2008-05-18 00:00:00 ) ) 我知道這個另有用處。但是如果不想要中間多那一層,該如何處理? $postData = $this->Post->find('all',array(??), array(??)); -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.248.113.44 ※ 文章網址: http://www.ptt.cc/bbs/PHP/M.1405657915.A.FCB.html
文章代碼(AID): #1JoACx_B (PHP)
討論串 (同標題文章)
文章代碼(AID): #1JoACx_B (PHP)