TP5 自定義模板路徑 渲染完整模板

2021-08-07 09:27:52 字數 431 閱讀 8179

如果你的模板檔案位置比較特殊或者需要自定義模板檔案的位置,可以採用下面的幾種方式處理。

return $view->fetch('./template/public/menu.html');

這種方式需要帶模板路徑和字尾指定乙個完整的模板檔案位置,這裡的template/public目錄是位於當前專案入口檔案位置下面。如果是其他的字尾檔案,也支援直接輸出,例如:

return $view->fetch('./template/public/menu.tpl');

只要./template/public/menu.tpl是乙個實際存在的模板檔案。

獲取更多資料,進入qq群:543592003

tp5自定義命令

建立自定義命令列 1.首先是註冊cammand return 2.建立類,繼承cammand usethink console command class chat extends command protected function execute input input,output outpu...

Tp5自定義標籤

taglib build in cx,tags 內建標籤庫名稱 標籤使用不必指定標籤庫名稱 以逗號分隔 注意解析順序 namespace think template taglib use think template taglib class tags extends taglib access ...

tp5自定義異常處理

1.傳統模式自定義異常處理 定義model層分母為0的異常資訊 url api model index.php use think exception class index catch exception ex return true 定義controller層index資訊 use think ...