猿问

求解释,在php中del如何做到根据id删除,并将ID传递到index()方法内的?

这是代码
<?php
// 本类由系统自动生成,仅供测试用途
class DabAction extends Action {
public function index(){
$wtid=$_GET['wtid'];
$Data = M('dab'); // 实例化Data数据模型
$this->wj = $Data->where('wtid='.$wtid)->select();
//dump($this->wj);
$this->wtid=$wtid;
$this->display();
}
public function add(){
$wtid=$_GET['wtid'];
$this->wtid=$wtid;
$this->display();
}

public function insert(){
$model=M('dab');
$data=$model->create();
$model->add();
$this->success('增加成功','__URL__/index/wtid/'.$data['wtid']);
}

public function edit(){
$daid=$_GET['daid'];
$model=M('dab');
$this->daid=$daid;
$this->dab=$model->where('daid='.$daid)->find();
$this->display();

}

public function save(){
$model=M('dab');
$data=$model->create();
$model->save();
//$this->wjid=$wjid;
$this->success('修改成功','__URL__/index/wtid/'.$data['wtid']);

}

public function delete(){
$daid=$_GET['daid'];
$wtid=$_GET['wtid'];
$model=M('dab');
$this->dab=$model->where('daid='.$daid)->delete();
$this->success('删除成功','__URL__/index/wtid/'.$wtid['wtid']);

}

}

?>

一只甜甜圈
浏览 225回答 1
1回答

收到一只叮咚

问题1:那是sql的事,不关php的事问题2:index()加参数或加一个全局
随时随地看视频慕课网APP
我要回答