?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
Attribute Name | Type | Required | Default | Description |
---|---|---|---|---|
var | mixed | Yes | n/a | variable (or string) to evaluate |
assign | string | No | n/a | the template variable the output will be assigned to |
屬性 | 類(lèi)型 | 是否必須 | 缺省值 | 描述 |
---|---|---|---|---|
var | mixed | Yes | n/a | 待求值的變量(或字符串) |
assign | string | No | n/a | 輸出值將被賦給模板變量的名稱(chēng) |
eval is used to evaluate a variable as a template. This can be used for things like embedding template tags/variables into variables or tags/variables into config file variables.
eval 按處理模板的方式計(jì)算取得變量的值. 該特性可用于在配置文件中的標(biāo)簽/變量中嵌入其它模板標(biāo)簽/變量.
If you supply the special "assign" attribute, the output of the eval function will be assigned to this template variable instead of being output to the template.
如果指定了 "assign" 這個(gè)特殊屬性,該函數(shù)的輸出值將被賦給由 assign 指定的模板變量,而不是直接輸出.
Technical Note: Evaluated variables are treated the same as templates. They follow the same escapement and security features just as if they were templates.
技術(shù)要點(diǎn): 待求值處理的變量被當(dāng)作模板來(lái)處理. 它們和模板一樣遵循同樣的結(jié)構(gòu)和安全特性.
Technical Note: Evaluated variables are compiled on every invocation, the compiled versions are not saved! However if you have caching enabled, the output will be cached with the rest of the template.
技術(shù)要點(diǎn): 待求值處理的變量每次調(diào)用時(shí)被重編譯,不保存編譯版本! 但當(dāng)打開(kāi)緩沖設(shè)置時(shí),該輸出會(huì)被其它模板緩沖.
Example 8-4. eval
|