?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
Smarty can catch many errors such as missing tag attributes or malformed variable names. If this happens, you will see an error similar to the following:
Smarty能夠發(fā)現(xiàn)許多類(lèi)似缺少標(biāo)簽屬性或者不規(guī)范變量名這樣的錯(cuò)誤。如果發(fā)生這種錯(cuò)誤,就會(huì)有下面的錯(cuò)誤提示:
Example 17-1. Smarty errors錯(cuò)誤
|
Smarty shows you the template name, the line number and the error. After that, the error consists of the actual line number in the Smarty class that the error occured.
Smarty可以顯示模板名稱(chēng)以及行號(hào)和錯(cuò)誤。這些錯(cuò)誤顯示未所發(fā)生錯(cuò)誤所屬的smarty類(lèi)所在的實(shí)際行號(hào)。
There are certain errors that Smarty cannot catch, such as missing close tags. These types of errors usually end up in PHP compile-time parsing errors.
某些錯(cuò)誤Smarty不能捕捉,像缺少結(jié)束標(biāo)簽。這些類(lèi)型的錯(cuò)誤通常會(huì)在在php分析語(yǔ)法錯(cuò)誤的編譯時(shí)間中就捕捉出來(lái)了.
Example 17-2. PHP parsing errors
|
When you encounter a PHP parsing error, the error line number will correspond to the compiled PHP script, not the template itself. Usually you can look at the template and spot the syntax error. Here are some common things to look for: missing close tags for {if}{/if} or {section}{/section}, or syntax of logic within an {if} tag. If you can't find the error, you might have to open the compiled PHP file and go to the line number to figure out where the corresponding error is in the template.
當(dāng)你遇到一個(gè)php解析錯(cuò)誤時(shí),錯(cuò)誤行號(hào)將反應(yīng)到php編譯腳本,而不是模板本身。通常,你會(huì)看到模板并發(fā)現(xiàn)語(yǔ)法錯(cuò)誤。通常會(huì)發(fā)現(xiàn):缺少if}{/if} 或者 {section}{/section}的結(jié)束標(biāo)簽?;蛘遻if}標(biāo)簽內(nèi)的邏輯語(yǔ)法錯(cuò)誤。如果你不能檢查出錯(cuò)誤,那就得在模板中打開(kāi)php編譯文件按照行號(hào)找出相應(yīng)錯(cuò)誤。