Create New Document

The title of your document (will be displayed as H1)
URL-friendly name (no spaces, use dashes)
Path where to create document (optional, use forward slashes to create subdirectories)

Move/Rename Document

Current location of the document
New path for the document (including the slug)
This only changes the document's path. It does not modify the document's title (H1 heading).

Delete Document

Are you sure you want to delete this document? This action cannot be undone.

Warning: If this is a folder, all contents including subfolders and documents will be deleted.

Message

Message content goes here.

Confirm Action

Are you sure?

Attachments

Allowed file types: jpg, jpeg, png, gif, svg, webp, txt, log, csv, sfd, zip, pdf, docx, xlsx, pptx, mp4 (Max: 10MB)

Document Files

Loading attached files...

Document History

Previous Versions

Loading versions...

Preview

Select a version to preview

Wiki Settings

Language for the user interface
Number of versions to keep per document. Set to 0 to disable versioning.
Maximum allowed file size for uploads in MB.

User Management

Add New User

Leave empty to keep current password
Users with these groups can access restricted sections.

Define path-based access rules for sections of your wiki, then assign users to groups in the Users tab. Rules are evaluated in order. First match wins.

Active Rules

Import markdown files from a ZIP archive. Files will be processed and stored in the appropriate document structure. Directory structure in the ZIP (category/subcategory) will be preserved in the wiki.

Upload a ZIP file containing markdown (.md) files to import.

Create and manage backups of your wiki data. Backups include all documents, images, and configuration files.

Available Backups

Loading backups...

Add/Edit Access Rule

Selected: /

Add Column

Banner

ThinkPHP Model method

模型的增删改查 --最佳实践-模型外的静态方法

1.新增

1.1增加一条数据create

MenuModel::create([
    'name'  =>  'thinkphp',
    'email' =>  'thinkphp@qq.com'
]);

1.2批量增加数据saveAll

MenuModel::saveAll([
    [
        'pid'=>0,
        'name'=>'aa11',
        'url'=>'aa21',
        'icon'=>'aa31',
        'sort'=>1,
        'menu_show'=>1,
        'status'=>1
    ],
    [
        'pid'=>0,
        'name'=>'aa111',
        'url'=>'aa221',
        'icon'=>'aa331',
        'sort'=>1,
        'menu_show'=>1,
        'status'=>1
    ],

]);

2.删除

2.1先查询再删除find-delete-返回布尔值

$user = User::find(1);
$user->delete();

2.2根据主键删除 destroy

User::destroy(1);
// 支持批量删除多个数据
User::destroy([1,2,3]);

2.3条件删除

//还支持使用闭包删除,例如:
User::destroy(function($query){
    $query->where('id','>',10);
});
//或者通过数据库类的查询条件删除
User::where('id','>',10)->delete();

3.更新

3.1查找并更新find-save

//在取出数据后,更改字段内容后使用`save`方法更新数据。**这种方式是最佳的更新方式**
$user = User::find(1);
$user->name     = 'thinkphp';
$user->email    = 'thinkphp@qq.com';
$user->save();
//支持传入数组进行数据更新
$user = User::find(1);
$user->save([
    'name'    =>    'thinkphp',
    'email'    =>    'thinkphp@qq.com'
]);

3.2批量更新数据

//可以使用saveAll方法批量更新数据,只需要在批量更新的数据中包含主键即可,例如:
$user = new User;
$list = [
    ['id'=>1, 'name'=>'thinkphp', 'email'=>'thinkphp@qq.com'],
    ['id'=>2, 'name'=>'onethink', 'email'=>'onethink@qq.com']
];
$user->saveAll($list);
//测试静态方法saveAll有效
$user = User::saveAll($list);

3.3直接更新(静态方法)update

User::update(['name' => 'thinkphp'], ['id' => 1]);

//如果你的第一个参数中包含主键数据,可以无需传入第二个参数(更新条件)
User::update(['name' => 'thinkphp', 'id' => 1]);

4查询

4.1获取单个数据find

// 根据主键获取多个数据
$res = MenuModel::find(1);
// 使用查询构造器查询 指定任意字段
$res = MenuModel::where('id', 1)->find();

4.2获取多个数据select

// 根据主键获取多个数据
$res = MenuModel::select([1,2,3]);
// 使用查询构造器查询 指定任意字段
$res = MenuModel::where('status', 1)->limit(3)->order('id', 'asc')->select();

Attached Files

Loading attached files...
Search Results