LCMS:: - 操作

X - 错误页面

LCMS::X($errcode, $errmsg, $go = "");
//$errcode 错误代码
//$errmsg 错误提示
//$go 如果是链接地址,3秒钟后会自动跳转
//$go 如果是数组,支持配置多个按钮
$go = [[
    "title"  => "按钮文字",
    "url"    => "按钮链接",
    "target" => "_blank", //_blank 或 _self
    "color"  => "danger", //支持layui的按钮颜色
]];

Y - 成功页面

LCMS::X($errcode, $errmsg, $go = "");
//$errcode 成功代码
//$errmsg 成功提示
//$go 如果是链接地址,3秒钟后会自动跳转
//$go 如果是数组,支持配置多个按钮
$go = [[
    "title"  => "按钮文字",
    "url"    => "按钮链接",
    "target" => "_blank", //_blank 或 _self
    "color"  => "danger", //支持layui的按钮颜色
]];

cache - 读写应用临时配置/硬盘存储

LCMS::cache($name);  //读取配置
LCMS::cache($name, $array);  //写入配置,配置必须是一个数组,长度不限
LCMS::cache($name, "clear");  //删除配置
//超级管理员清除缓存->清除配置缓存可删除所有配置

ram - 读写应用临时配置/内存存储

LCMS::ram($name);  //读取配置
LCMS::ram($name, $string);  //写入配置,配置必须是一个字符串,长度限255字符
LCMS::ram($name, $string, $time); //$time,多少秒后自动删除配置,不设置time默认24小时过期
LCMS::ram($name, "clear");  //删除配置
//重启服务器,所有配置将会清空

config - 读写应用永久配置

//读取配置
$config = LCMS::config([
    "name"  => "name", // 选填,不传此参数默认为当前应用的名字
    "cate"  => "cate", // 选填,数据分类,和写入数据要对应
    "lcms"  => true, // 选填,SaaS模式会用到,指定用户的数据,true:超级管理员的数据,null:当前用户的数据,数字:指定rootid用户的数据
]);
//写入配置
LCMS::config([
    "do"    => "save", // 选填,save为保存,不传此参数为读取
    "name"  => "name", // 选填,不传此参数默认为当前应用的名字
    "cate"  => "cate", // 选填,数据分类,不传默认为auto,注意卸载应用操作要删除对应数据
    "lcms"  => true, // 选填,SaaS模式会用到,指定用户的数据,true:超级管理员的数据,null:当前用户的数据,数字:指定rootid用户的数据
    "unset" => "a|b|c", // 选填 字段名,在保存数据的时候强制更新某些字段数据
]);

template - 加载模板

require LCMS::template("own/index"); // 应用目录下的模板
require LCMS::template("ui/head"); // 系统UI模板
require LCMS::template($path); // 任意目录的模板

form - 读写表数据

//读取数据
$data = LCMS::form([
    "table" => "tablename", // 必填,数据表
    "id"    => "id", //必填,数据ID
    "lcms"  => "0", // 选填,SaaS模式会用到,指定用户的数据,true:超级管理员的数据,null:当前用户的数据,数字:指定rootid用户的数据
]);
//写入数据
LCMS::form([
    "table" => "tablename", // 必填,数据表
    "do"    => "save", // 必填,save为保存
    "id"    => "id", // 选填,操作的数据id,不填默认为表单form里的id
    "lcms"  => "0", // 选填,指定用户的数据,不传此参数默认当前用户
    "unset" => "a|b|c", // 选填,字段名,在保存数据的时候强制更新某些字段
]);
大纲