think-orm插件

v1.0.2
版本
2022-04-13
版本更新时间
770
安装
3
star
简介
think-orm是ThinkPHP官方的一个基于PHP和PDO的数据库中间层和ORM类库。
webman/think-orm
是一个自动化安装卸载 topthink/think-orm
的插件。它不是对topthink/think-orm
的二次封装,它只是一个自动化安装脚本,用于自动安装topthink/think-orm
并自动配置webman的插件。
安装
composer require -W webman/think-orm
安装后将自动生成 config/thinkorm.php
数据库配置文件,开发者需要根据实际情况手动更改数据库配置。
提示
如果出现无法安装,可能是由于使用了composer代理导致,可运行命令composer config -g --unset repos.packagist
去掉代理再次尝试。
使用
<?php
namespace app\controller;
use support\Request;
use think\facade\Db;
class Foo
{
public function get(Request $request)
{
$user = Db::table('user')->where('uid', '>', 1)->find();
return json($user);
}
}
更多请参考topthink/think-orm文档