首页内核与基础Helper-输入与数据族
Helper-输入与数据族
\Kuoqi\Helper 的输入获取、数据库、URL、会话、配置等基础方法

方法清单

方法签名说明
getInputgetInput($name="",$default=NULL,$filter=NULL)输入获取(对应全局 I())
MysqlMysql($isPrefix="",$asName=false)数据库驱动(对应全局 M())
urlurl($route=NULL,$query=[],$origin=false)URL 生成(对应全局 url())
configconfig($n,$v=null)读/写配置(对应全局 config())
getConfiggetConfig($n)读取配置值
setConfigsetConfig($n,$v=null)设置配置值,返回 bool
sessionsession($name,$value="")读/写会话(对应全局 session())
getSession / setSession / delSession($name) / ($sn,$sv) / ($name)会话读写删
curlcurl($url="",$method="",$params=[],$rsptype="",$timeout=0)HTTP 请求(转发 Curl::sendTo)
loadfileloadfile($file,$once=true)加载文件(转发 Kuoqi::loadfile)
optsopts($inputs,$defs,$defname="")参数装配
useCtrluseCtrl($route,$params=[])调用其它控制器返回输出流(对应全局 Ctrl())
useTemplateuseTemplate($layoutId,$tplArgs=[])渲染子模板返回字符串(对应全局 template())
典型用法
// 会话读写删
\Kuoqi\Helper::setSession("cart", array(1,2,3));
$cart = \Kuoqi\Helper::getSession("cart");
\Kuoqi\Helper::delSession("cart");

// HTTP 请求
$html = \Kuoqi\Helper::curl("https://example.com/api", "POST",
    array("name" => "test"), "json", 10);

// 调用其它控制器
$stream = \Kuoqi\Helper::useCtrl("Home/Index/Index");
KuoqiPHP v1.05 · 离线静态文档 · 界面基于 KuoqiUI · 返回首页