zoukankan      html  css  js  c++  java
  • 夺命雷公狗---Smarty NO:18 html_checkboxes

    功能:把数组转化为复选框

    基本语法:

    {html_checkboxes name=’cust’  values=$cust_ids  checked=$customer_id  output=$cust_names  separator=”<br />”}

    参数说明:

    name:为checkbox命名

    values:为checkbox中的选项赋予value值,要求是一个数组

    checked:选中的值,要求是一个数组

    output:显示输出的文本值,要求是一个数组

    separator:选项与选项之间的分隔符

    demo6.php示例代码:

    <?php
    require “smarty/Smarty.class.php”;
    $smarty = new Smarty();
    //output假如是从数据库中读取出来的数据
    $output = array(‘php’,’apache’,’mysql’,’linux’);
    $values = array(1,2,3,4);//依次对应上面的值得
    $checked = array(1,3);
    $smarty -> assign(‘output’,$output);
    $smarty -> assign(‘values’,$values);
    $smarty -> assign(‘checked’,$checked);
    $smarty -> display(‘demo6.html’);

    demo6.html

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=’utf-8′>
    <title></title>
    </head>
    <body>
    {*html_checkboxes*}
    {html_checkboxes name=’like’ output=$output values=$values checked=$checked separator='<br/>’}
    </body>
    </html>
  • 相关阅读:
    双目对物体定位
    七个不变特征识别
    bmp和opencv格式转换
    职业规划
    input disp fprintf用法
    多线程
    访问权限
    机器人运动学仿真
    MOTOCOM32运动控制器编程
    回调函数以及钩子函数的概念
  • 原文地址:https://www.cnblogs.com/leigood/p/5033411.html
Copyright © 2011-2022 走看看