跳至主內容區

XOOPS輕鬆架

:::

主內容區域

選擇後會自動跳轉頁面

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 只要沒出現錯誤訊息就是正確的,正常的話,目前應該是一片空白。
選擇後會自動跳轉頁面

:::

左邊區域內容

書籍目錄

展開 | 闔起

快速登入


右邊區域內容

請掃此 QR Code 可連至此頁面

計數器

今天: 2051205120512051
昨天: 3465346534653465
總計: 9590864959086495908649590864959086495908649590864

頁尾區域