PHP code example of linzening / devtools

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

    

linzening / devtools example snippets


use linzening\devtools\CacheLock; //Lock进程锁

$lock = new CacheLock('id_5');

$lock->lock(); //加锁
$lock->unlock(); //解锁

$fileName = "某某项目数据合并导出";
$Excel['fileName'] = $fileName.date('Y年m月d日-His',time());//文件名称
//$Excel['cellName'] = 9; //可省略
$Excel['H'] = [8,12,18,12,18,18,36,12,14];//如果是数组,即为每一列的宽度
$Excel['H'] = 2; //如果是数字,则为增加的宽度

$Excel['sheetTitle'] = $fileName.'个人详细';//表格大标题 自定义
$Excel['sheetName']='个人详细';//表格名称 自定义
$Excel['xlsCell']=[
    ['i','序号'],
    ['grade','年级'],
    ['classfull','班级'],
    ['realname','姓名'],
    ['studentid','学号'],
    ['datetime','時間'],
    ['content','內容'],
    ['setcount','次數'],
    ['admin_name','管理員'],
];
$Excel['expTableData'] = model('core')->every_user($part,$year); //二维数组,对应`xlsCell`参数

$Excels[] = $Excel;

$parts = array_group_by($list,'partid');

$list0 = [];
foreach ($parts as $key => $value) {
    $item0['partid'] = $value[0]['partid'];
    $item0['partname'] = $value[0]['name'];
    $item0['items'] = [];
    foreach ($value as $key1 => $value1) {
        $item0['items'][] = [
            'major_id' => $value1['major_id'],
            'major_name' => $value1['major_name'],
            'short' => $value1['short'],
        ];
    }
    $list0[] = $item0;
}

$fileName = "某某项目数据不合并导出2";
$Excel['fileName'] = $fileName.date('Y年m月d日-His',time());//or $xlsTitle
$Excel['H'] = [22,20,30,40,30];//横向水平宽度

$Excel['sheetTitle'] = $fileName;//大标题,自定义
$Excel['sheetName'] = '扣除';//表格名称
$Excel['xlsCell']=[
    ['partid','学院ID'],
    ['partname','学院名称'],
    ['major_id','专业ID'],
    ['major_name','专业名称'],
    ['short','专业简称']
];
$Excel['expTableData'] = $list0;
$Excels[] = $Excel;

if($Excels){
    // 导出复杂的Excel
    \linzening\devtools\Spread::excelPuts($Excels);
}
exit('暂无数据导出');

// 导出精简的Excel
\linzening\devtools\Spread::excelPuts($list);
// 导出CVS文件
\linzening\devtools\Spread::cvsPuts($list);

echo \linzening\devtools\Structure6::all_tables('system','markdown','','',2);

// 输出模板
public function html($page='deny'){
    // $page in deny,deving,holiday,notice,starting,temporary,upgrade-browser
    return \linzening\devtools\Template::template($page);
}

$r = new \linzening\devtools\Request();
$ip = $r->get_client_ip(0,true,'HTTP_X_FORWARDED_FOR');