PHP_the 16th day

本文介绍了作者开始学习Smarty框架的过程,详细记录了如何使用该框架实现PHP代码与前端代码的分离,并通过省市县三级联动的例子展示了具体的实现方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

沉寂了一段时间,总算是开始了新的学习,步入框架时代;

第一步,学习smarty框架;

M: model类;

V:view视图(静态模板);

C:control(核心,PHP);

实现PHP代码和前端代码分离;

初步改造--省市县三级联动:

<?php
    require("mysql.class.php");
    require("./smarty/Smarty.class.php");
    
    $smarty = new Smarty();
    $smarty->cache_dir = "./cache";
    $smarty->compile_dir = "./compile";
    $smarty->template_dir = "./template";
    
    $provinceList = $mysql->getAll( "SELECT * FROM ecs_region WHERE parent_id = 1" );    
    
    $smarty->assign("provinceList",$provinceList);            
    $smarty->display("index.html");            //渲染

?>


<select name="province" id="province">
        <option value="0">请选择省</option>

        {foreach $provinceList as $k => $v}

        <option value="{$v.region_id}">{$v.region_name}</option>

        {/foreach}

</select>

<select name="city" id="city">
        <option value="0">请选择市</option>
</select>
<select name="district" id="district">
        <option value="0">请选择县</option>
</select>

接下来,继续改造之前项目--信息管理系统;

未来的路,任重而道远,我有许多憧憬,全凭自己拼搏;

你的方法是最简便的方法吗? 我的表的字段有:loan_bill_no loan_type instal_terms cur_terms unique_id prod_cd loan_date cleared_date dpd max_dpd loan_status trans_term 1st_repayable_date 1st_cleared_date 1st_dpd 2nd_repayable_date 2nd_cleared_date 2nd_dpd 3rd_repayable_date 3rd_cleared_date 3rd_dpd 4th_repayable_date 4th_cleared_date 4th_dpd 5th_repayable_date 5th_cleared_date 5th_dpd 6th_repayable_date 6th_cleared_date 6th_dpd 7th_repayable_date 7th_cleared_date 7th_dpd 8th_repayable_date 8th_cleared_date 8th_dpd 9th_repayable_date 9th_cleared_date 9th_dpd 10th_repayable_date 10th_cleared_date 10th_dpd 11th_repayable_date 11th_cleared_date 11th_dpd 12th_repayable_date 12th_cleared_date 12th_dpd 13th_repayable_date 13th_cleared_date 13th_dpd 14th_repayable_date 14th_cleared_date 14th_dpd 15th_repayable_date 15th_cleared_date 15th_dpd 16th_repayable_date 16th_cleared_date 16th_dpd 17th_repayable_date 17th_cleared_date 17th_dpd 18th_repayable_date 18th_cleared_date 18th_dpd 19th_repayable_date 19th_cleared_date 19th_dpd 20th_repayable_date 20th_cleared_date 20th_dpd 21th_repayable_date 21th_cleared_date 21th_dpd 22th_repayable_date 22th_cleared_date 22th_dpd 23th_repayable_date 23th_cleared_date 23th_dpd 24th_repayable_date 24th_cleared_date 24th_dpd 25th_repayable_date 25th_cleared_date 25th_dpd 26th_repayable_date 26th_cleared_date 26th_dpd 27th_repayable_date 27th_cleared_date 27th_dpd 28th_repayable_date 28th_cleared_date 28th_dpd 29th_repayable_date 29th_cleared_date 29th_dpd 30th_repayable_date 30th_cleared_date 30th_dpd 31th_repayable_date 31th_cleared_date 31th_dpd 32th_repayable_date 32th_cleared_date 32th_dpd 33th_repayable_date 33th_cleared_date 33th_dpd 34th_repayable_date 34th_cleared_date 34th_dpd 35th_repayable_date 35th_cleared_date 35th_dpd 36th_repayable_date 36th_cleared_date 36th_dpd 37th_repayable_date 37th_cleared_date 37th_dpd 38th_repayable_date 38th_cleared_date 38th_dpd 39th_repayable_date 39th_cleared_date 39th_dpd 40th_repayable_date 40th_cleared_date 40th_dpd 41th_repayable_date 41th_cleared_date 41th_dpd 42th_repayable_date 42th_cleared_date 42th_dpd 43th_repayable_date 43th_cleared_date 43th_dpd 44th_repayable_date 44th_cleared_date 44th_dpd 45th_repayable_date 45th_cleared_date 45th_dpd 46th_repayable_date 46th_cleared_date 46th_dpd 47th_repayable_date 47th_cleared_date 47th_dpd 48th_repayable_date 48th_cleared_date 48th_dpd 49th_repayable_date 49th_cleared_date 49th_dpd 50th_repayable_date 50th_cleared_date 50th_dpd 51th_repayable_date 51th_cleared_date 51th_dpd 52th_repayable_date 52th_cleared_date 52th_dpd 53th_repayable_date 53th_cleared_date 53th_dpd 54th_repayable_date 54th_cleared_date 54th_dpd 55th_repayable_date 55th_cleared_date 55th_dpd 56th_repayable_date 56th_cleared_date 56th_dpd 57th_repayable_date 57th_cleared_date 57th_dpd 58th_repayable_date 58th_cleared_date 58th_dpd 59th_repayable_date 59th_cleared_date 59th_dpd 60th_repayable_date 60th_cleared_date 60th_dpd etl_time etl_source contr_no master_contr_no master_child_contr_flag ovd_begin_date repayable_prin repay_match_prin_amt ovd_prin spl_prin trade_amt mob req_time dt
07-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值