zoukankan      html  css  js  c++  java
  • iwebshop 增删改查

    <?php
    header("content-type:text/html;charset=utf-8");
    class Test extends IController
    {
        public $checkRight  = array('check' => 'all',
                       'uncheck' => array('default','admin_repwd','admin_repwd_act','navigation','navigation_update','navigation_del','navigation_edit','navigation_recycle','navigation_recycle_del','navigation_recycle_restore')); public $layout = 'admin'; public function init() { IInterceptor::reg('CheckRights@onCreateAction'); } //展示添加页面 public function hello() { // echo "欢迎使用Iweb框架。"; /* $testObj = new IModel("member"); $arr = $testObj->query(); $time=$arr[0]['time']; $x=time($time); echo $x."&nbsp;&nbsp;&nbsp;"; echo time(date('Y-m-d H:i:s'));*/ $this->redirect('hello'); } //确定添加 public function adds() { $name = IFilter::act(IReq::get("name")); $sex = IFilter::act(IReq::get("sex")); $testObj = new IModel("test"); $arr=array("name"=>$name,"sex"=>$sex); $testObj->setData($arr); $testObj->add(); //echo $name.",".$sex; $this->redirect('show'); } //展示数据 public function show() { $testObj = new IModel("test"); $arr = $testObj->query(); // $arr =array(array('id'=>1)); $this->list=$arr; //var_dump($arr); $this->redirect('show'); } //删除数据 public function del() { $id = IFilter::act(IReq::get("id")); $testObj = new IModel("test"); $testObj->del("id=$id"); $this->redirect('show'); } //展示修改页面 public function upd() { $testObj = new IModel("test"); $id = IFilter::act(IReq::get("id")); $arr = $testObj->query("id=$id"); $this->list=$arr; //var_dump($arr); $this->redirect('upd'); } //确定修改 public function sureMake() { $id = IFilter::act(IReq::get("id")); $name = IFilter::act(IReq::get("name")); $sex = IFilter::act(IReq::get("sex")); $testObj = new IModel("test"); $test = array( 'id'=>$id, 'name'=>$name, 'sex'=>$sex ); $testObj->setData($test); $where = "id=".$id; $testObj->update($where); $this->redirect('show'); } } ?> {foreach: items=$this->list} <tr> <td>{$item['id']}</td> <td>{$item['name']}</td> <td>{$item['sex']}</td>
  • 相关阅读:
    当import的模块内容发生变化时,对此模块进行重新加载(刷新)
    使用python的ctypes库实现内存的动态申请和释放
    【转载】实现博客园图片的可放大功能
    使用tqdm实现下载文件进度条
    pytest参数化的两种方式
    Jmeter之Bean shell使用-常用内置变量
    JMeter之Ramp-up Period(in seconds)说明
    Jmeter性能测试基础
    接口测试基础
    JMeter做http接口功能测试
  • 原文地址:https://www.cnblogs.com/aini521521/p/6836474.html
Copyright © 2011-2022 走看看