茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    CI框架整合smarty步驟詳解
    來源:易賢網(wǎng) 閱讀:1151 次 日期:2016-08-20 14:05:16
    溫馨提示:易賢網(wǎng)小編為您整理了“CI框架整合smarty步驟詳解”,方便廣大網(wǎng)友查閱!

    本文詳細(xì)講述了CI框架整合smarty步驟。分享給大家供大家參考,具體如下:

    Ci結(jié)合smarty的配置步驟:

    1. 第一步配置ci和下載smarty的模板個(gè)人喜歡用(Smarty-3.1.8)這個(gè)版本。

    2. 第二部把下載到的smarty版本解壓然后把里面的libs文件改名為smarty然后把這個(gè)文件拷到ci\application\libraries目錄下面

    3. 在ci\application\libraries這個(gè)目錄下面建立一個(gè)文件,文件名可以自定義,例如見一個(gè)tp.php的文檔。

    4. 用編譯器打開tp.php然后寫入以下代碼:

    <?php

    if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    require_once('smarty/smarty.class.php');

    class Tp extends Smarty{

     function tp(){

      parent::Smarty();

      $this->template_dir = APPPATH.'views';

      $this->compile_dir = APPPATH.'templates_c/';

      $this->left_delimiter = '<{';

      $this->right_delimiter = '}>';

     }

    }

    5. 在建立一個(gè)ci\application\templates_c文件夾

    6. 打開ci\application\config\autoload.php文件把

    $autoload['libraries'] = array();

    改成:

    $autoload['libraries'] = array('database','tp');

    OK我們的配置到這里就已經(jīng)成功了,接下來我們開始測(cè)試

    測(cè)試的第一步先建立一個(gè)控制器:

    1. 在\application\controllers下建立一個(gè)文件名為ceshi.php的文件,文件內(nèi)容

    <?php

    if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class Home extends CI_Controller {

      function __construct()

      {

       parent::__construct();

       $this->load->helper('url');

       $this->tp->assign('base_url', base_url());

       //定義css以及js的路徑

      }

      function index()

      {

       $this->tp->assign("title","恭喜你smarty安裝成功!");

       $this->tp->assign("body","歡迎使用smarty模板引擎");

       $arr = array(1=>'zhang',2=>'xing',3=>'wang');

       $this->tp->assign("myarray",$arr);

       $this->tp->display('ceshi.html');

      }

    }

    2.建立模板文件在ci\application\views目錄下建立文件名為ceshi.html的文件,文件內(nèi)容為

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

     <script src='<!--{$base_url}-->js/jQuery.min.js' type='text/JavaScript' ></script>

     <link href="<!--{$base_url}-->css/login.css" rel="stylesheet" type="text/css" />

     <title>smarty安裝測(cè)試</title>

    </head>

    <body>

    <h1><{$title}></h1>

    <p><{$body}></p>

    <ul>

      <{foreach from=$myarray item=v}>

      <li><{$v}></li>

      <{/foreach}>

    </ul>

    </body>

    </html>

    最后輸入地址http://localhost/ci/application/index.php/ceshi (主意ci代表的是你自己放置ci框架中文件的根目錄)運(yùn)行以后你將會(huì)看到你配置smarty成功的頁面,到這里ci和smarty的整合以及測(cè)試就完工了

    希望本文所述對(duì)大家基于CodeIgniter框架的PHP程序設(shè)計(jì)有所幫助。

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:CI框架整合smarty步驟詳解
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢 | 簡(jiǎn)要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)