1.建議該方法放在basecontroller中,方便全域性呼叫
2. controller 中呼叫//靜態模板生成目錄
protected $statichtmldir = "";
//靜態檔案
protected $statichtmlfile = "";
/*** 判斷是否存在靜態
** @param string $key 靜態檔名稱,傳入,方便出問題時候檢視
* @param string $index 靜態檔案存放一級資料夾
*/public function beforebuild($key = "",$index = "index")
//靜態檔案存在,並且沒有過期
if(file_exists($this->statichtmlfile) && filectime($this->statichtmlfile)>=time()-60*60*24*5)
}/**
* 開始生成靜態檔案
* * @param $html
*/public function afterbuild($html)
if(file_put_contents($this->statichtmlfile,$html)) }}
tp6初探基礎
通過命令列安裝 composer create project topthink think tp命令列安裝的tp6會在根目錄下生成 example.env檔案 此為環境變數示例檔案 重新命名為 env按需求修改即可,修改後預設開啟了除錯模式 檢視.env檔案,設定除錯模式開關 true 開啟除錯時...
TP6安裝單應用和TP6安裝多應用
php 7.1.0 必須使用composer安裝更新tp61 第一次安裝,在命令列下面,切換到你的web根目錄下 面並執行下面的命令 tp是專案檔名稱可以修改 composer create project topthink think tp2 詳細安裝檢視官方文件 1 在命令列下面,切換到你的專案...
TP6資料庫作業
1.查詢所有email欄位為 thinkphp qq.com 的資料。dump db table think tp where email thinkphp qq.com select 查詢id為3的資料email列的值。dump db table think tp where id 3 selec...