我在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);
}
}
您尝试过在重定向中使用back方法吗?
尝试
Return 'Redirect::back()->with('error', $message);