Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

Chapter 20. 疑难解答

Table of Contents

Smarty/PHP 错误

Smarty/PHP 错误

Smarty�以�获多�错误,如错误的标签�写错的���等等。 如果�生这些错误,Smarty将如下�示:

Example 20.1. Smarty 错误


Warning: Smarty: [in index.tpl line 4]: syntax error: unknown tag - '%blah'
       in /path/to/smarty/Smarty.class.php on line 1041

Fatal error: Smarty: [in index.tpl line 28]: syntax error: missing section name
       in /path/to/smarty/Smarty.class.php on line 1041

    

Smarty会显示模��字,错误行数和错误内容。 还会接�显示在Smarty类文件真实错误�生的行数。

部分错误是Smarty无法�获的。如忘记了写分�等。 这�类型一般会在PHP编译时直接�示。

Example 20.2. PHP 错误�示


Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75

    

当�示PHP错误,系统会�示Smarty已编译的PHP文件出错的行数, 而�是模�代�的行数。 一般你�以查看模�代�并且寻找出错的代�。 下�是一些通常�以检查的地方: 是�丢失了关闭标签如{if}{/if} 或者 {section}{/section} , 或是{if}标签内的逻辑等。. 如果无法找到错误�置,你�以打开已编译的PHP文件�定�问题,然�这对应找出模�的错误�置。

Example 20.3. 其他的常�错误


Warning: Smarty error: unable to read resource: "index.tpl" in...
or
Warning: Smarty error: unable to read resource: "site.conf" in...

  • $template_dir出现的错误, 在 templates/目录中 ä¸�存在index.tpl文件。

  • {config_load}函数,(或调用 configLoad()函数) ,$config_dir 出现的错误,目录中找ä¸�到site.conf文件。


Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist,
or is not a directory...

    
  • $compile_dirä¸�正确,目录ä¸�存在;或者 templates_cä¸�是目录而是文件。


Fatal error: Smarty error: unable to write to $compile_dir '....

    
  • $compile_dir在æœ�务器上无法写入文件。 关于文件æ�ƒé™�问题,å�‚考下é�¢ Smarty安装的文章。


Fatal error: Smarty error: the $cache_dir 'cache' does not exist,
or is not a directory. in /..

    
  • è¿™æ„�味ç�€ï¼Œ $cachingå·²ç»�å¼€å�¯ï¼Œ 但$cache_dir ä¸�正确,目录ä¸�存在;或者 cache/ä¸�是目录而是文件。


Fatal error: Smarty error: unable to write to $cache_dir '/...

    
  • è¿™æ„�味ç�€ï¼Œ$caching å·²ç»�å¼€å�¯ï¼Œ $cache_dir在æœ�务器上无法写入文件。 关于文件æ�ƒé™�问题,å�‚考下é�¢ Smarty安装的文章。


Warning: filemtime(): stat failed for /path/to/smarty/cache/3ab50a623e65185c49bf17c63c90cc56070ea85c.one.tpl.php 
in /path/to/smarty/libs/sysplugins/smarty_resource.php

   
  • è¿™æ„�味ç�€ï¼Œä½ çš„应用程åº�å·²ç»�注册了自定义错误处ç�†å™¨ï¼ˆä½¿ç”¨ set_error_handler()), 但该处ç�†å™¨æ²¡æœ‰å¤„ç�†å½“å‰�çš„$errno。 如果,ä¸�管什么ç�†ç”±ï¼Œè¿™æ˜¯ä½ çš„自定义错误处ç�†å™¨çš„处ç�†æ–¹å¼�çš„è¯�, 那么在注册你的错误处ç�†å™¨å�Žï¼Œè°ƒç”¨ muteExpectedErrors()。


�� 调试。

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 12 plus 5? (Are you human?)

Advertisement