?
? ????? PHP ??? ???? ??? ?? ??
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)許多類似缺少標簽屬性或者不規(guī)范變量名這樣的錯誤。如果發(fā)生這種錯誤,就會有下面的錯誤提示:
Example 17-1. Smarty errors錯誤
|
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可以顯示模板名稱以及行號和錯誤。這些錯誤顯示未所發(fā)生錯誤所屬的smarty類所在的實際行號。
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.
某些錯誤Smarty不能捕捉,像缺少結(jié)束標簽。這些類型的錯誤通常會在在php分析語法錯誤的編譯時間中就捕捉出來了.
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.
當你遇到一個php解析錯誤時,錯誤行號將反應(yīng)到php編譯腳本,而不是模板本身。通常,你會看到模板并發(fā)現(xiàn)語法錯誤。通常會發(fā)現(xiàn):缺少if}{/if} 或者 {section}{/section}的結(jié)束標簽?;蛘遻if}標簽內(nèi)的邏輯語法錯誤。如果你不能檢查出錯誤,那就得在模板中打開php編譯文件按照行號找出相應(yīng)錯誤。