Skip to content

Commit cecd27f

Browse files
authored
Merge pull request #5 from Tinywan/patch-2
Update README.md
2 parents 58d6c8e + 994c1c1 commit cecd27f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
适用于不使用ThinkPHP框架的开发者。
1010

1111
安装
12-
~~~
12+
13+
```php
1314
composer require topthink/think-orm
14-
~~~
15+
```
1516

1617
Db类用法:
17-
~~~
18+
19+
```php
1820
use think\Db;
1921
// 数据库配置信息设置(全局有效)
2022
Db::setConfig(['数据库配置参数(数组)']);
2123
// 进行CURD操作
2224
Db::table('user')->find();
23-
~~~
25+
```
2426

2527
Db类增加的(静态)方法包括:
2628
- `setConfig` 设置全局配置信息
@@ -32,23 +34,24 @@ Db类增加的(静态)方法包括:
3234
其它操作参考TP5.1的完全开发手册[数据库](https://www.kancloud.cn/manual/thinkphp5_1/353998)章节
3335

3436
定义模型:
35-
~~~
37+
38+
```php
3639
<?php
3740
namespace app\index\model;
3841
use think\Model;
3942
class User extends Model
4043
{
4144
}
42-
~~~
45+
```
4346

4447
代码调用:
4548

46-
~~~
49+
```php
4750
use app\index\model\User;
4851

4952
$user = User::get(1);
5053
$user->name = 'thinkphp';
5154
$user->save();
52-
~~~
55+
```
5356

54-
更多模型用法可以参考5.1完全开发手册的[模型](https://www.kancloud.cn/manual/thinkphp5_1/354041)章节
57+
更多模型用法可以参考5.1完全开发手册的[模型](https://www.kancloud.cn/manual/thinkphp5_1/354041)章节

0 commit comments

Comments
 (0)