gpt4 book ai didi

PHP : Error: Wrong parameters for Exception with thrown Array Exception

转载 作者:可可西里 更新时间:2023-11-01 13:40:19 25 4
gpt4 key购买 nike

我像这样使用数组抛出异常:

$response = array('login_email' => '<div class="warning">Your email and / or password were incorrect</div>');

throw new \Exception($response);

我正在捕捉的是:

Error: Wrong parameters for Exception([string $exception [, long $code [, Exception $previous = NULL]]])

有什么想法吗?

最佳答案

Exception() 不会接受数组。你需要给它一个字符串。

$response = 'Your email and / or password were incorrect.';

throw new \Exception($response);

读取错误:

Exception([string $exception [, long $code [, Exception $previous = NULL]]])

关于PHP : Error: Wrong parameters for Exception with thrown Array Exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12218993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com