在 codeigniter 裡的 helper 使用資料庫 紅色死神 發表於 2017年7月18日 星期二 7月 18, 2017 / 沒有留言 標籤 CodeIgniter, php 如果要在 ci 的 helper 裡面使用資料庫,必須要使用 & get_instance() ,用法如下。 view plaincopy to clipboardprint$ci=& get_instance(); $ci->load->database(); //do something $ci->db->insert('your_table', $data); 要呼叫資料庫都用 $ci 取代 $this 以電子郵件傳送這篇文章BlogThis!分享至 Twitter分享至 Facebook 反應:
0 意見:
張貼留言