iwebshop中的增删改查

xiaoxiao2021-02-28  110

<?php class Text extends IController { public function hello() { $this->redirect('hello'); } public function liu() { $login_info = $_COOKIE['iweb_user_id']; if (empty($login_info)) { echo "<script>alert('请先登陆!');location.href='http://localhost/test/iwebshop4.6/index.php?controller=simple&action=login'</script>"; } else { $goods_ren = IFilter::act(IReq::get('ren'), 'int'); // print_r($goods_id);die; $goods_nrong = IFilter::act(IReq::get('nrong'), 'int'); $testObj = new IModel("text"); $arr = array("ren" => $goods_ren, "nrong" => $goods_nrong); $testObj->setData($arr); $testObj->add(); //echo $name.",".$sex; $this->redirect('show'); } } public function show() { $testObj = new IModel("text"); $arr = $testObj->query(); // $arr =array(array('id'=>1)); $this->list = $arr; // var_dump($arr); $this->redirect('show'); } public function shan() { $id = IFilter::act(IReq::get('id'), 'int'); $testObj = new IModel("text"); $testObj->del("id=$id"); $this->redirect('show'); } //展示修改页面 public function upd() { $testObj = new IModel("text"); $id = IFilter::act(IReq::get("id"), 'int'); $arr = $testObj->query("id=$id"); $this->list = $arr; // var_dump($arr);die; $this->redirect('upd'); } //确定修改 public function sureMake() { $id = IFilter::act(IReq::get("id")); $name = IFilter::act(IReq::get("ren")); $sex = IFilter::act(IReq::get("nrong")); $testObj = new IModel("text"); $test = array( 'id' => $id, 'ren' => $name, 'nrong' => $sex ); $testObj->setData($test); $where = "id=" . $id; $testObj->update($where); $this->redirect('show'); }

 

转载请注明原文地址: https://www.6miu.com/read-79882.html

最新回复(0)