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>
  • 相关阅读:
    Python 写Windows Service服务程序
    关于Python 获取windows信息收集
    Pyqt 获取windows系统中已安装软件列表
    Python 打开目录与指定文件
    【转载】Pyqt 编写的俄罗斯方块
    Python win32api提取exe图标icon
    Pyqt QListWidget之缩略图列表
    Pyqt 时时CPU使用情况
    Python 的三目运算
    Chrome Crx 插件下载
  • 原文地址:https://www.cnblogs.com/aini521521/p/6836474.html
Copyright © 2011-2022 走看看