我在laravel 4上有返回重定向的问题。我怎么能返回错误重定向?
public function Verify( $data )
{
try
{
$this->_initSoap( $data['store_url'] );
} catch (\SoapFault $e) {
// login failed logic
$faultcode = $e->faultcode; // ex: 2
$message = $e->faultstring; // ex: Access denied.
//die('aaaa'. $message );// return redirect, etc...
return \Redirect::to('user/stores/magento')->with('error', $message);
}
}
我遇到了这样的问题
ErrorException (E_UNKNOWN)
Header may not contain more than a single header, new line detected
Open: /var/www/haroldas.ggggg.com/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
// status
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
// headers
foreach ($this->headers->allPreserveCase() as $name => $values) {
foreach ($values as $value) {
header($name.': '.$value, false, $this->statusCode);
}
}
答案 0 :(得分:1)
您是否尝试在重定向中使用back方法?
尝试
Return \Redirect::back()->with('error', $message);