<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                例子3 1.php ``` session_start(); // 1.引入Smarty模板引擎 include 'libs/Smarty.class.php'; // 2.實例化Smarty $smarty = new Smarty; // var_dump($smarty); // 3.配制 // 設置模板目錄 $smarty->template_dir = 'view'; // 設置編譯目錄 $smarty->compile_dir = 'compile'; // 緩存 $smarty->caching = true; // 開啟緩存 $smarty->cache_dir = 'cache'; // 設置緩存目錄 $smarty->cache_lifetime = 10; // 緩存的時間 // 設置左右定界符 //$smarty->left_delimiter = '<{'; //$smarty->right_delimiter = '}>'; // 4.分配變量(標量) $smarty->assign('username','zhangsan'); // 字符串 $smarty->assign('age', 20); // 整型 $smarty->assign('price', 3.5); // 浮點型 $smarty->assign('bool', false); // 布爾值 // 索引數組 $arr = [1,2,3,4,5]; $smarty->assign('arr', $arr); // 關聯數組 $arr1 = ['username'=>'lisi','age'=>20]; $smarty->assign('arr1', $arr1); // 對象 class Person { public $name = '王五'; } $smarty->assign('p', new Person); 3.定義超全局變量 // $_GET['p'] = 1; $_POST['username'] = '榮柱'; $_SESSION['admin'] = '合路'; setCookie('age', 20); 常量 define('HOST', 'localhost'); // 4.輸出模板 $smarty->display('1.html'); ``` libs文件夾放置smarty模板 view/1.html- ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <h3>{$username}</h3> <h3>{$age}</h3> <h3>{$price}</h3> <h3>{$bool}</h3> <h3>{$arr[1]}</h3> <h3>{$arr.2}</h3> <h3>{$arr1['username']}</h3> <h3>{$arr1.age}</h3> <h3>對象調用屬性:{$p->name}</h3> ``` 全局變量 ``` <h3>{$smarty.get.p}</h3> <h3>{$smarty.post.username}</h3> <h3>{$smarty.session.admin}</h3> <h3>{$smarty.cookies.age}</h3> <h3>客戶端的IP地址:{$smarty.server.REMOTE_ADDR}</h3> <h3>服務器的IP地址:{$smarty.server.SERVER_ADDR}</h3> <h3>返回當前的URL地址:{$smarty.server.REQUEST_URI}</h3> <h3>返回上一頁的URL地址:{$smarty.server.HTTP_REFERER}</h3> <h3>常量:{$smarty.const.HOST}</h3> </body> </html> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看