Smarty is a very popular template system. It separates business and logic, and runs fast. It is widely used in php websites.
However, a problem occurs when deploying it to sina app engine (sae). Because sae cannot perform file read/write operations as a cloud computing platform, the cached files output in Smarty cannot be implemented.
Error message: "SAE_Fatal_error: Uncaught exception 'smartyexception' with message 'unable to write file./web/templates_c/wrt4e95555280ef1 '"
The solution provided by SAE is to use Memcache. First, go to Application Management in the application, and enable Memcache initialization in service management,
Then modify the configuration file of Smarty:
// For SAE compiled files are stored in memcache
$ Smarty-> compile_dir = 'saemc: // smartytpl /';
$ Smarty-> cache_dir = 'saemc: // smartytpl /';
$ Smarty-> compile_locking = false; // to prevent touch calls, saemc automatically updates the time without touch
The preceding three rows are required.
In this way, the Smarty template can be run on SAE.
From neural Style Neural Networks