首先实体类User.php
<?php
namespace app\index\model;
use think\Model;
class User extends Model {
protected $pk = 'uuid';//指定主键
protected $table = 'tp_score';//指定表名
}
然后
<?php
namespace app\index\controller;
use app\index\model\User as User2;
use think\Db;
use think\db\Where;
class Search {
public function index() {
$result = User2::destroy('224466');//这里是删除'tp_score'表,以uuid为键值
User2::select()//查询'tp_score'表
}
}