sae中thinkphp使用smarty

來源:互聯網
上載者:User

標籤:

因為最近在學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的項目
  

在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

 

sae中thinkphp使用smarty

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.