wfdaj / foxql
SQL Query Builer
This package's canonical repository appears to be gone and the package has been frozen as a result.
dev-master
2021-06-30 03:18 UTC
This package is not auto-updated.
Last update: 2025-04-03 19:03:22 UTC
README
介绍
MySQL PHP库,完全拷贝自 webrium/foxql
安装 Foxql
composer require wfdaj/foxql
添加连接配置
use wfdaj\foxql\DB;
DB::addConfig('main',[
'driver' => 'mysql',
'db_host' => 'localhost',
'db_host_port' => 3306,
'db_name' => 'test',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8mb4',
'result_stdClass' => true
]);
现在可以开始工作了:)
SELECT
$user = DB::table('users')->find($user_id);
Method | Alias |
---|---|
where | and |
orWhere | or |
is | |
true | |
false |
where
..->where('name','jan')->..
( where , and )
DB::table('uses')
->where('age','>',18)
->and('score','>',200)
->get();
( where , or )
DB::table('uses')
->where('age','>',18)
->or('score','>',200)
->get();
( is , true , false )
is 方法默认为true,可以将第二个参数设置为false
$list = DB::table('users')->is('confirm')->get(); //.. `confirm` = true
$list = DB::table('users')->is('confirm',false)->get(); //.. `confirm` = false
// 您可以使用 true 或 false 方法
DB::table('users')->true('confirm')->get();
DB::table('users')->false('confirm')->get();
参与贡献
- Fork 本仓库
- 新建 Feat_xxx 分支
- 提交代码
- 新建 Pull Request