PHP code example of jackcnn / eacoophp

1. Go to this page and download the library: Download jackcnn/eacoophp 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/ */

    

jackcnn / eacoophp example snippets


// 获取所有用户
$map =[
	'status'=> ['egt', '0'], // 禁用和正常状态
];
list($data_list,$total) = model('common/User')->search('username|nickname')->getListByPage($map,true,'create_time desc',12);

$reset_password = [
    'icon'=> 'fa fa-recycle',
    'title'=>'重置原始密码',
    'class'=>'btn btn-default ajax-table-btn confirm btn-sm',
    'confirm-info'=>'该操作会重置用户密码为123456,请谨慎操作',
    'href'=>url('resetPassword')
];
        
return builder('List')
        ->setMetaTitle('用户管理') // 设置页面标题
        ->addTopButton('addnew')  // 添加新增按钮
        ->addTopButton('delete')  // 添加删除按钮
        ->addTopButton('self',$reset_password)  // 添加重置按钮
        ->setSearch('custom','请输入关键字')//自定义搜索框
        ->keyListItem('uid', 'UID')
        ->keyListItem('avatar', '头像', 'avatar')
        ->keyListItem('nickname', '昵称')
        ->keyListItem('username', '用户名')
        ->keyListItem('email', '邮箱')
        ->keyListItem('mobile', '手机号')
        ->keyListItem('reg_time', '注册时间')
        ->keyListItem('allow_admin', '允许进入后台','status')
        ->keyListItem('status', '状态', 'array',[0=>'禁用',1=>'正常',2=>'待验证'])
        ->keyListItem('right_button', '操作', 'btn')
        ->setListPrimaryKey('uid')//设置主键uid(默认id)
        ->setExtraHtml($extra_html)//自定义html
        ->setListData($data_list)    // 数据列表
        ->setListPage($total,12) // 数据列表分页
        ->addRightButton('edit') //添加编辑按钮
        ->addRightButton('delete')  // 添加编辑按钮
        ->fetch();