我正在使用Laravel,在我的网站上,我需要注册多个步骤。第一个视图是用户输入他的信息和个人资料图片,然后是第二个视图来选择帐户类型,第三个视图用Paypal支付费用。
我希望使用Input::all()
在最终视图中获取所有信息,我希望有一种简单的方法可以做到这一点
答案 0 :(得分:0)
我自己通过创建一个存储所有这些数据的php类来解决这个问题,然后创建这个类的对象并将其存储在会话中。
class data{
public $data1;
public $data2;
public $data3;
//must checks if the data is complete
function checkdata(){
if(condition){
return true;
}else{
return false;
}
}
}
//Store data in session or load existing data from session.
if(isset($_SESSION["data"]){
$data = $_SESSION["data"];
}else{
$data = new data();
$_SESSION["data"] = $data;
}
//do with the data whatever needs to be done. change the variables if needed etc.
$data->$data1 = $_POST["data1"];
//once all data is complete send and save it where it needs to be saved and unset the session
if($data->checkdata()){
saveorsenddata($data);
unset($_SESSION["data"]);
}//else do nothing