tp5中的配置機制

2022-01-30 14:25:22 字數 828 閱讀 2332

如果在index.php初始化中調整配置路徑,

那麼extra資料夾也要調整到那個路徑中去。

讀取配置檔案**,

<?php 

/** *

* @file index.php

* @date 2016-8-23 16:03:10

* @author zhenxun du<[email protected]>

* @version svn:$id:$

*///use think\config;

class index extends common

/*** 後台首頁

*/public function index()

}

如果使用config,需要use think/config;

不同模組下的配置也要在配置目錄下建立相應的資料夾,這樣就能針對性的獲取到配置資訊了。

tp5中捕獲異常的配置

首選在配置檔案中加入配置如下 值得注意的是該配置檔案必須是所有模組的而不是單個的模組的 目錄結構圖如下 請求異常 todo 開發者對異常的操作 if e getstatuscode 404 可以在此交由系統處理 return parent render e 然後就可以在編碼中捕捉異常了 trycat...

tp5框架原理詳解 TP5框架安全機制例項分析

防止sql注入 1 查詢條件盡量使用陣列方式,具體如下 wheres array wheres account account wheres password password user where wheres find 2 如果必須使用字串,建議使用預處理機制,具體如下 user d useri...

TP5偽靜態配置

為專案配置虛擬網域名稱 nginx 1 phpstudy 配置 站點網域名稱管理 正確配置指向應用專案 生成相應的配置檔案引數 本地配置host檔案 伺服器配置網域名稱 2 在nginx的conf裡面的vhosts.conf中找到剛剛生成的配置檔案引數在location 裡面配置 if e kate...