Spe*_*ark 5 php exception-handling exception
我正在使用这样的数组抛出异常:
$response = array('login_email' => '<div class="warning">Your email and / or password were incorrect</div>');
throw new \Exception($response);
Run Code Online (Sandbox Code Playgroud)
而我所追捕的是:
Error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])
Run Code Online (Sandbox Code Playgroud)
任何的想法?
Way*_*tty 13
Exception()不会采用数组.你需要给它一个字符串.
$response = 'Your email and / or password were incorrect.';
throw new \Exception($response);
Run Code Online (Sandbox Code Playgroud)
阅读错误:
异常([ string $ exception [,long $ code [,Exception $ previous = NULL]]])