💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
##**view方法** ###*获得* * * * * * 继承\msqphp\core\view\View对象 ###*模版变量操作* * * * * * ~~~ /** * @param string $key 变量键 * @param miexd $value 变量值 * @param bool $cache 变量是否缓存 * @param bool $html 是否仅为html文本(及不带有html标签或需要字符转义,特殊字符什么的纯文本,避免脚本攻击) */ //获得 $this->get(string $key) : miexd; //是否存在 $this->exists(string $key) : bool; //删除 $this->delete(string $key) : void; //设置,别名$this->assign $this->set(string $key, $value='', bool $cache=false, bool html =false) : void; //或者依次排列以为数组 $this->set([ 'key'=>$key, 'value'=>$value, 'cache'=>bool, 'type'=>bool ]); ~~~ ###*组件模版操作* * * * * * ~~~ /** * @param string $file_name 文件名/组件名 * @param int $expire 过期时间 * @param bool $last 是否为最终缓存 */ //需要组件(存在取缓存,不存在进行缓存 $this->display(string $file_name, int $expire = 86400) :self; //组件是否存在 $this->displayed(string $file_name) : bool; //拼装 $this->assemble(string $file_name, int $expire $last = true) : self; //展示 $this->show(string $file_name) : self; //是否展示过 $this->showed(string $file_name) : bool; //静态页面 $this->static(int $expire = 3600) : self; ~~~