Home  >  Article  >  Backend Development  >  How to use smarty template in sae_PHP tutorial

How to use smarty template in sae_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:18:02769browse

Smarty is a very popular template system. It separates business and logic, has fast execution speed, and is widely used in PHP websites.

However, there was a problem when deploying to sina app engine (sae). Because sae, as a cloud computing platform, cannot perform file reading and writing operations, the cache files output in Smarty cannot be realized.

Error message: "SAE_Fatal_error: Uncaught exception 'SmartyException' with message 'unable to write file ./web/templates_c/wrt4e95555280ef1' "

SAE’s solution is to use Memcache. First enter the application management in the application and enable Memcache initialization in the service management,

Then modify Smarty’s configuration file:

Copy the code The code is as follows:

// For SAE compiled files are stored in memcache
$smarty-> compile_dir = 'saemc://smartytpl/';
$smarty->cache_dir = 'saemc://smartytpl/';
$smarty->compile_locking = false; // Prevent calling touch, saemc will Automatically update time, no need to touch

The above three lines are required.

This way the Smarty template can run on SAE.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/621684.htmlTechArticleSmarty is a very popular template system. It separates business and logic and has fast execution speed. It has Widely used. However, there was a problem when deploying to sina app engine (sae)...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn