幾個比較常見的Thinkphp代碼
慕田峪7331174
2018-07-06 11:10:36
TA貢獻1829條經驗 獲得超6個贊
public function test(){ //查詢單條數據 $result =M( "表名" )->where( "條件" )->find(); //查詢多條數據 $result =M( "表名" )->where( "條件" )->find(); //刪除數據 $result =M( "表名" )->where( "條件" )->del(); //修改數數據 $data [ '字段名稱' ]= "值" ; $result =M( "表名" )->where( "條件" )->save( $data ); //新增數據 $data [ '字段名稱' ]= "值" ; $result =M( "表名" )->add( $data ); } |
基操,數據庫增刪改查
舉報