Issue
I am using $this->redirect to redirect from one action to another
$this->redirect(array('site/payment','bookingID'=>$bookingID,'orderID'=>$model->quoteNo,'amount'=>$rent));
But I don't why it showing parameter in url
https://www.siteurl.com/bookingID/5/orderID/123456/amount/220.00
How do I hide my data from user?
Solution
You can do it using sessions. You can access current Session with Yii::$app->session
. You can send those parameters in session.. For Example
public function actionOne() {
// Check if the Session is Open, and Open it if it isn't Open already
if (!Yii::$app->session->getIsActive()) {
Yii::$app->session->open();
}
Yii::$app->session['bookingID'] = $bookingID;
Yii::$app->session['orderID'] = $model->quoteNo;
Yii::$app->session['amount'] = $rent;
Yii::$app->session->close();
$this->redirect(['site/payment']);
}
public function actionTwo() {
// Then you can get those values like this...
$bookingID= Yii::$app->session['bookingID'];
$orderID= Yii::$app->session['orderID'];
$amount= Yii::$app->session['amount'];
// do whatever you want..
}
Answered By - Asfandyar Khan
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.