欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

smarty自定義函數(shù)htmlcheckboxes用法實例

 更新時間:2015年01月22日 11:26:34   投稿:shichen2014  
這篇文章主要介紹了smarty自定義函數(shù)htmlcheckboxes用法,實例分析了smarty模板與函數(shù)的使用技巧,需要的朋友可以參考下

本文實例講述了smarty自定義函數(shù)htmlcheckboxes用法。分享給大家供大家參考。具體如下:

訪問文件:index.php:

復制代碼 代碼如下:
<?php
require_once('libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir($_SERVER['DOCUMENT_ROOT']."/php/templates/");
$smarty->setCompileDir($_SERVER['DOCUMENT_ROOT']."/php/templates_c/");
$smarty->setCacheDir($_SERVER['DOCUMENT_ROOT']."/php/cache/");
$smarty->caching = false;

$smarty->assign('cust_ids',array(1000,1001,1002,1003));
$smarty->assign('cust_name',array("喜洋洋","美洋洋","懶洋洋","哈哈哈"));
$smarty->assign('customer_id',1001);

$smarty->display("temp.htm");
?>


模板文件:temp.htm
復制代碼 代碼如下:
{html_checkboxes values=$cust_ids output=$cust_name selected=$customer_id}

測試結果:utf-8下顯示正常,但文件編碼為ANSI時,中文不能顯示。

希望本文所述對大家的php程序設計有所幫助。

相關文章

最新評論