模板路径相关替换:config/template.php
// 模板替换
'tpl_replace_string' =>[
'__ADMIN__'=>'/static/admin'
]
界面引入:
<link href="__ADMIN__/css/animate.css" rel="stylesheet">
tp5.1 模型返回的是对象 db返回的是数组,所以在做数据统计时,需要注意,对象可以直接统计
tp5 打印sql
use think\Db; dump( Db::table('table_name')->getLastSql());
或者
使用fetchSql方法直接返回当前的查询SQL而不执行,例如: echo User::fetchSql()->find(1);
或者
use think\Db; dump( Db::getLastSql());
获取IP
如何获取用户真实IP地址:从$_SERVER[‘REMOTE_ADDR’]这个超全局变量里面获取
解决TP5.1 报错:Non-static method think\Cookie::get() should not be called statically
use think\facade\Config;
模板截取字符:
{$d['title']|mb_substr=0,10,'utf-8'}