首页 > 代码库 > TP代码
TP代码
<?php
// 本类由系统自动生成,仅供测试用途
class IndexAction extends Action {
public function index(){
$this->display();
}
function into_add()
{
date_default_timezone_set(‘Asia/Shanghai‘);
$M=M("user");
$data=http://www.mamicode.com/$_POST;
$data[‘in_date‘]=date(‘y-m-d H:i:s‘,time());
//print_r($data);exit;
$q=$M->add($data);
echo "<script language=‘javascript‘>alert(‘success‘);location.href=http://www.mamicode.com/‘".__URL__."/user_list‘;</script>";
}
function user_list()
{
$M=M("user");
$data=http://www.mamicode.com/$M->field(array("id","uname","email","fail"))->select();
//print_r($data);exit;
$this->assign("data",$data);
$this->display("userlist");
}
function user_delete()
{
$M=M("user");
$ID=$_GET[‘id‘];
$data=http://www.mamicode.com/$M->where(array("id"=>$ID))->delete();
$this->display("userupdate");
echo "<script language=‘javascript‘>alert(‘success‘);location.href=http://www.mamicode.com/‘".__URL__."/user_list‘;</script>";
}
}
TP代码