:::

3-1 安裝Smarty樣板引擎

  1.  Smarty的官網在:http://www.smarty.net
  2. Smarty 5.x 的文件在:https://smarty-php.github.io/smarty/stable/
  3. 用composer安裝Smarty,按 Ctrl+` 開啟終端機,並貼上:
    composer require smarty/smarty
  4. 建立四個Smarty需要的目錄,亦可按 Ctrl+` 開啟終端機,並貼上:
    mkdir templates
    mkdir templates_c
    mkdir configs
    mkdir cache
    • templates:放置原始樣板的目錄(一定會用到
    • templates_c:編譯後的樣板目錄(需可寫入
    • configs:設定目錄(不見得會用到)
    • cache:樣板快取目錄(需可寫入

       

  5. 要使用Smarty佈景引擎,必須先引入自動載入檔,然後實體化一個佈景引擎,我們先建立 index.phpadmin.php 然後輸入:
    <?php
    require 'vendor/autoload.php';
    use Smarty\Smarty;
    $smarty = new Smarty();

     

  6. 接著可以執行 http://localhost/php8/index.php 只要沒出現錯誤訊息就是正確的,正常的話,目前應該是一片空白。

:::

書籍目錄

展開 | 闔起

http%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1997%26tbsn%3D55

計數器

今天: 3015301530153015
昨天: 2259225922592259
總計: 7951813795181379518137951813795181379518137951813