亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        smarty簡(jiǎn)單模板變量輸出方法

        字號(hào):


            本文簡(jiǎn)單講述了Smarty的模板變量輸出方法。分享給大家供大家參考,具體如下:
            config.inc.php配置文件如下:
            include_once('smarty/Smarty.class.php');
            $smarty=new Smarty();
            $smarty->config_dir="smarty/Config_File.class.php";
            $smarty->caching=false; //是否開啟緩存
            $smarty->template_dir="./templates"; //模板目錄
            $smarty->compile_dir="./templates_c"; //編譯目錄
            $smarty->cache_dir="./smarty_cache"; //緩存目錄
            $smarty->left_delimiter="<{";
            $smarty->right_delimiter="}>";
            index.php文件如下:
            include('./config.inc.php');
            $title="php測(cè)試標(biāo)題";
            $content="smarty練習(xí)!";
            $newstext[]=array("name"=>"php程序測(cè)試","date"=>"2015-08-01");
            $newstext[]=array("name"=>"php視頻教程","date"=>"2015-08-02");
            $newstext[]=array("name"=>"smarty學(xué)習(xí)","date"=>"2015-08-03");
            $row=array("標(biāo)題","姓名","年齡");
            $smarty->assign("title",$title);
            $smarty->assign("row",$row);//一個(gè)數(shù)組傳遞多個(gè)值
            $smarty->assign("shownewstext",$newstext);//二維數(shù)組傳遞多個(gè)值
            $smarty->assign("content",$content);
            $smarty->display('index.htm');
            運(yùn)行結(jié)果如下:
            測(cè)試數(shù)組:標(biāo)題 | 姓名 | 年齡 
            --------------------------------------------------------------------------------
            測(cè)試內(nèi)容為:smarty練習(xí)! 
            循環(huán)新聞內(nèi)容為:
            php程序測(cè)試 - 2015-08-01
            php視頻教程 - 2015-08-02
            smarty學(xué)習(xí) - 2015-08-03
            希望本文所述對(duì)大家基于Smarty模板的php程序設(shè)計(jì)有一定幫助作用。