How to use smarty template in sae_PHP tutorial

WBOY
Release: 2016-07-13 17:18:02
Original
768 people have browsed it

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)...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!