TP3 2 模板引用頭和尾 html檔案

2021-09-07 15:28:37 字數 1374 閱讀 6520

傳送門:

模版表示式的定義規則為:模組@主題/控制器/操作

例如:

<

include

file

="public/header"

/>

// 包含頭部模版header

<

include

file

="public/menu"

/>

// 包含選單模版menu

<

include

file

="blue/public/menu"

/> // 包含blue主題下面的menu模版

為了相容3.1的寫法,也可以支援:

<

include

file

="public:header"

/>

<

include

file

="public:menu"

/>

<

include

file

="blue:public:menu"

/>

可以一次包含多個模版,例如:

<

include

file

="public/header,public/menu"

/>

可以直接包含乙個模版檔名(包含完整路徑),例如:

<

include

file

/>

無論你使用什麼方式包含外部模板,include標籤支援在包含檔案的同時傳入引數,例如,下面的例子我們在包含header模板的時候傳入了title和keywords變數:

<

include

file

="public/header"

title

="thinkphp框架"

keywords

="開源web開發框架"

/>

就可以在包含的header.html檔案裡面使用title和keywords變數,如下:

<

html

xmlns

="">

<

head

>

<

title

>[title]

title

>

<

meta

name

="keywords"

content

="[keywords]"

/>

head

>

tp3 2復合查詢

where member.ming array like key where xueyuan.xingming array like key where xueyuan.dizhi array like key where xueyuan.shoujihao array like key where...

tp3 2自動驗證

namespace home model usethink model class usermodel extends model x u 使用者名稱長度為3 18位字元 2 password require 密碼不能為空 password a za z 0 9 a za z0 9 密碼格式不對 必...

tp3 2 語言切換

1 return array 3 1 lang switch on true,開啟語言包功能 2 lang auto detect true,自動偵測語言 開啟多語言功能後有效 3 lang list zh cn,en us 允許切換的語言列表 用逗號分隔 4 var language l 預設語言...