thinkphp5 增删改查
Genius 发布于 阅读:62
<?php
namespace app\before\controller;
use think\Controller;
use think\Db;
//use app\before\model\Article;
class Before extends Controller
{
public function Index()
{
$sj = Db::name('brand');
$ss = $sj->where('brand_id',179)->order('brand_id','desc')->value('brand_name');
$sq = $sj->removeOption('where')->removeOption()->select(); //清理上一次where查询保存 安全重要 , 第二个removeOption清理order
// return json($sq);
return Db::getlastSql();
// $sj = Article::select();
// return json($sj);
$data = [
'brand_name' => '测试1',
'brand_logo' => '测试2',
'brand_desc' => '测试3',
'site_url' => '1',
'sort_order' => 1,
'is_show' => 1,
];
//$updatagai = Db::name('brand')->where('brand_id',179)->update($data); //改
//$insertadd = Db::name('brand')->insert($data); //新增
//$del = Db::name('brand')->delete(186); //删除 默认主键
//return $del;
}
}
?>