您的位置:首页 > 编程语言 > PHP开发

tp跳转

2015-06-08 14:38 555 查看
常用跳转:

if($result){
$this->success('操作成功!');
}else{
$this->error('写入错误!');
}*/


redirect跳转 :

$this->redirect("User/viewuser"); // Tpl下的 页面文件,即视图一级目录User/页面文件。 可简写 $this->redirect("viewuser");

给提示并跳转:

$this->success('操作成功', 'replylist'); //本视图层下的replylist. 。 第二个参数为 Tpl下的页面文件 。 同上

带数据跳转

//显示个人客户详情
public function view_customer(){

$customer = M('customer');
if($_GET){
$data = $customer->find($_GET['id']);
$this->assign('data',$data);   //将查询结果给$data变量
if($_GET['customer_style']=='0'){

$this->display("view_customerp");//显示本视图层下的view_customerp

}else{
$this->redirect("view_customercom");
}
}else{
echo "传入参数错误!";
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: