zoukankan      html  css  js  c++  java
  • sae中thinkphp使用smarty

    因为最近在学thinkphp跟着做一个小商城。

    没有使用thinkphp自带的think引擎,使用的是smarty引擎。

    sea中使用的时候出现了问题。已经是前几天的事了,问题图片没保存下来。

    在网上百度了很多方法,都是一样的内容:

     首先进入sae应用中的应用管理中,在服务管理中开启Memcache一个初始化。

     然后修改Smarty的配置文件:

      // For SAE 编译文件存放在memcache中
      $smarty->compile_dir = 'saemc://smartytpl/';
      $smarty->cache_dir = 'saemc://smartytpl/';

      // 防止调用touch,saemc会自动更新时间,不需要touch
      $smarty->compile_locking = false; 

    总共三行,但是由于我是新手,这个上面说的配置文件具体指的不知道是哪个。

    最后试了很多次终于试对了。

    加在自己的项目的配置文件:

      比如thinkphp中我建了一个叫shop的项目
      sae的thinkphp中配置smarty

    在config.php文件中加入TMPL_ENGINE_CONFIG常量,如下所示。

    'TMPL_ENGINE_CONFIG' => array(

    'compile_dir' => 'saemc://smartytpl/',
    'cache_dir' => 'saemc://smartytpl/',
    'compile_locking' => false, // 防止调用touch,saemc会自动更新时间,不需要touch
    ),

    这样就OK了。

    使用的smarty地址:https://code.google.com/p/smarty4sae/downloads/list

  • 相关阅读:
    SpringBoot的缓存
    jsp标签指定id区域内容显示和隐藏
    Linux awk统计日志中出现过的IP(或出现次数最多的N个IP)
    回文数
    算法z形字符串
    最长回文字符串
    redis与Mysql数据同步
    算法(1)
    滑动窗口算法
    HTTP长连接和短连接
  • 原文地址:https://www.cnblogs.com/lostk/p/4211845.html
Copyright © 2011-2022 走看看