PHP高级Smarty基础二配置 配置文件 config下的文件 1. config1.ini name = 王 age = 18 sex = 男 lang.ini [cn] name = 姓名 age = 年龄 [en] name = name age = age php $smarty->assign('title','读取配置文件中的变量'); $smarty->assign('作者王明昌发布时间2018-01-10最后更新2018-01-10文章目录配置 配置文件变量调节器 截断缓存清除缓存继承配置 配置文件 config下的文件 1. config1.ini 复制name = 王 age = 18 sex = 男 lang.ini 复制[cn] name = 姓名 age = 年龄 [en] name = name age = age php 复制$smarty->assign('title','读取配置文件中的变量'); $smarty->assign('lang',$_GET['lang']); $smarty->display('./4.html'); html {{config_load file='config1.ini'}}{{$smarty.config.name}}{{$smarty.config.age}}{{$smarty.config.sex}}{{#sex#}}{{config_load file='lang.ini' section = $lang}}{{#name#}}{{#age#}}变量调节器 截断 PHP 复制session_start(); $_SESSION['user']='用户'; $smarty->assign('title','变量调节器'); $smarty->assign('content','zxcvbnmasdfghjklqwertyuiop'); $smarty->display('./5.html'); HTML 复制 {{$smarty.session.user|default:'游客'}} {{$content|truncate:9}} 缓存 根据id分别进行缓存 PHP 复制/判断缓存是否存在,如果不存在查询数据库,如果存在使用缓存 if(!$smarty->isCached('./6.html',$_GET['id'])){ $mysql = new Model('info'); $res = $mysql->field(array('id','name','age'))->find(1); // print_r($res); $smarty->assign('user', $res); echo "进行了数据查询"; } $smarty->display('6.html',$_GET['id']);//可以根据id分别进行缓存 清除缓存复制$smarty->clearCache('4.html');//清除某个模版的缓存 $smarty->clearCache('6.html',2);//清除某个模版中指定号的的缓存 $smarty->clearAllCache();//清除全部模版的缓存 继承 父页 复制{{block name="css"}} 我是内容 {{/block}} 子页 复制//先继承 {{extends file="index/index.html"}}//file路径相对于template下的子目录为根目录 //要改写的部分 {{block name="css"}} 我是内容 {{/block}}
2018-08-22支付宝支付接口错误说明错误查询 https://docs.open.alipay.com/58/103599/ 今天我遇到的一个错误,经过询问小二,网关错误,错误如下 ILLEGAL_ACCESS_SWITCH_SYSTE
2019-12-10阿里巴巴开源镜像提供的 packagist 镜像服务全局配置(推荐) 所有项目都会使用该镜像地址: composer config -g repo.packagist composer https://mirrors.aliyun.com/compos
2017-02-03Adobe CC 2017 正式版(WIN版本+MAC版本)Adobe Creative Cloud 2017 软件于2016 年11月2日 更新上市。 Adobe Creative Cloud 2017 为多国语言版本:中文,英文,韩文,日本等多国语言, 在
2018-08-26实例 | 支付宝支付(使用md5加密)参数的获取 pid|key获取: 商户中心---账户管理---查看pid|key https://openhome.alipay.com/platform/keyManage.htm?keyType=
2018-10-31实例 | tp5使用七牛云上传图片和文件/删除文件thinkphp5中使用七牛云 下载 https://github.com/qiniu/php-sdk vendor文件下 新建文件 application/extra/qiniu.php retur
2018-05-28ajax-post传值的写法var data = {type:type,is_ok:is_ok,id:id}; $("#train").on("click",function(){ var id = $("#id_res").v