1
$this->redirect(array($redirect, 'error' => $error, 'msg' => $msg, 'details' => $details));

How can we pass array as a parameter? I have tried during redirection.

Returning:

Error 400 Your request is invalid.

Any help would be appreciated.

6
  • Why do you want to pass array? Commented Dec 5, 2017 at 11:02
  • as per my requirement I have too many data to pass on, that's why Commented Dec 5, 2017 at 11:03
  • create a string separated with & instead of passing array. Commented Dec 5, 2017 at 11:04
  • I knew, but that is not a solution Commented Dec 5, 2017 at 11:04
  • stackoverflow.com/a/13717351/4248328 Commented Dec 5, 2017 at 11:04

2 Answers 2

1

After a lots of tries I have found that , the array what I was passing is an associative array and passing with GET method, so while redirection if we seen in URL, associative array passing with every internal element of $details array, and same parameters are not listed at destination method, so the result will not found such a method.

Sign up to request clarification or add additional context in comments.

3 Comments

Your explanation is not clear: please post a complete code example.
Not needed to post a code, as we can not pass array like that, so I have sent separate variable as a single params
Yes, you can pass asociative arrays in url with GET. The problem is that isn't possible giving complex datatypes using method redirect() with Yii (and Yii2). The problem is with Yii not with the GET method. The method is founded. The returned error is: Invalid data received for parameter "{param}".
0

If redirect to different page

$this->redirect(array('YourController/YourFunction','error'=>$error,'msg'=>$msg,'details'=>$details));

If in the same controller you just need to put your function on the array. hope this can help

1 Comment

I have already tried, your answer is already in my question, see.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.