PHP code example of yirius / icesui
1. Go to this page and download the library: Download yirius/icesui library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yirius / icesui example snippets
init完成后,初始化后台登录地址为/icesui/manage,账号为12345678912,密码为123456
php think icescommand:init (该命令为初始化所有的数据库文件,在运行该命令前,请先配置database)
php think icescommand:assets (该命令为拷贝所有的assets到public/static/文件夹)
php think icescommand:config (该命令为拷贝config.php到config/icesui.php,可以进行自定义配置,配置项可以打开icesui.php之后查看)
public function groupadd($id = 0){
$authGroup = new AuthGroup();
if($this->request->isPost()){
$post = input('post.');
if(!empty($post['isall']) && $post['isall'] == 1){
$post['rules'] = "all";
}
unset($post['isall']);
$authGroup->AutoSave($post);
}
$value = $id == 0?[]:$authGroup->where('id', $id)->find();
if(!empty($value['rules']) && $value['rules'] == "all"){
$value['isall'] = 1;
$value['rules'] = "";
}
$formBuilder = new FormBuilder();
return $formBuilder
->setFormValue($value)
->addText("角色名称", "title")
->addRadio("是否开启", "status", [
['text' => "开启", "value" => 1],
['text' => "关闭", "value" => 0],
])
->addRadio("是否所有权限", "isall", [
['text' => "是", "value" => 1],
['text' => "否", "value" => 0],
])
->addZtree("权限设置", "rules", Auth::instance()->getUserMenuForTree(), !empty($value['rules'])?explode(",", $value['rules']):[])
->form();
}