php可以捕捉内存溢出吗,php - 使用Try / Catch PHP方法捕获条带错误 - 堆栈内存溢出...

编程入门 行业动态 更新时间:2024-10-28 22:24:05

===============>>#1 票数:101

在网站上测试STRIPE的过程中,我构建了如下代码:

try {

$charge = Stripe_Charge::create(array(

"amount" => $clientPriceStripe, // amount in cents

"currency" => "usd",

"customer" => $customer->id,

"description" => $description));

$success = 1;

$paymentProcessor="Credit card (www.stripe)";

}

catch (Stripe_InvalidRequestError $a) {

// Since it's a decline, Stripe_CardError will be caught

$error3 = $a->getMessage();

}

catch (Stripe_Error $e) {

// Since it's a decline, Stripe_CardError will be caught

$error2 = $e->getMessage();

$error = 1;

}

if ($success!=1)

{

$_SESSION['error3'] = $error3;

$_SESSION['error2'] = $error2;

header('Location: checkout.php');

exit();

}

问题是有时卡有错误(我那里没有“捕获”参数捕获),“尝试”失败,页面立即在屏幕上显示错误,而不是进入“ if”和重定向回checkout.php。

我应该如何构建我的错误处理的结构,以便得到错误并立即重定向回checkout.php并在其中显示错误?

谢谢!

引发错误:

Fatal error: Uncaught exception 'Stripe_CardError' with message 'Your card was declined.' in ............

/lib/Stripe/ApiRequestor.php on line 92

===============>>#2 票数:66 已采纳

在网站上测试STRIPE的过程中,我构建了如下代码:

try {

$charge = Stripe_Charge::create(array(

"amount" => $clientPriceStripe, // amount in cents

"currency" => "usd",

"customer" => $customer->id,

"description" => $description));

$success = 1;

$paymentProcessor="Credit card (www.stripe)";

}

catch (Stripe_InvalidRequestError $a) {

// Since it's a decline, Stripe_CardError will be caught

$error3 = $a->getMessage();

}

catch (Stripe_Error $e) {

// Since it's a decline, Stripe_CardError will be caught

$error2 = $e->getMessage();

$error = 1;

}

if ($success!=1)

{

$_SESSION['error3'] = $error3;

$_SESSION['error2'] = $error2;

header('Location: checkout.php');

exit();

}

问题是有时卡有错误(我那里没有“捕获”参数捕获),“尝试”失败,页面立即在屏幕上显示错误,而不是进入“ if”和重定向回checkout.php。

我应该如何构建我的错误处理的结构,以便得到错误并立即重定向回checkout.php并在其中显示错误?

谢谢!

引发错误:

Fatal error: Uncaught exception 'Stripe_CardError' with message 'Your card was declined.' in ............

/lib/Stripe/ApiRequestor.php on line 92

===============>>#3 票数:11

在网站上测试STRIPE的过程中,我构建了如下代码:

try {

$charge = Stripe_Charge::create(array(

"amount" => $clientPriceStripe, // amount in cents

"currency" => "usd",

"customer" => $customer->id,

"description" => $description));

$success = 1;

$paymentProcessor="Credit card (www.stripe)";

}

catch (Stripe_InvalidRequestError $a) {

// Since it's a decline, Stripe_CardError will be caught

$error3 = $a->getMessage();

}

catch (Stripe_Error $e) {

// Since it's a decline, Stripe_CardError will be caught

$error2 = $e->getMessage();

$error = 1;

}

if ($success!=1)

{

$_SESSION['error3'] = $error3;

$_SESSION['error2'] = $error2;

header('Location: checkout.php');

exit();

}

问题是有时卡有错误(我那里没有“捕获”参数捕获),“尝试”失败,页面立即在屏幕上显示错误,而不是进入“ if”和重定向回checkout.php。

我应该如何构建我的错误处理的结构,以便得到错误并立即重定向回checkout.php并在其中显示错误?

谢谢!

引发错误:

Fatal error: Uncaught exception 'Stripe_CardError' with message 'Your card was declined.' in ............

/lib/Stripe/ApiRequestor.php on line 92

===============>>#4 票数:9

在网站上测试STRIPE的过程中,我构建了如下代码:

try {

$charge = Stripe_Charge::create(array(

"amount" => $clientPriceStripe, // amount in cents

"currency" => "usd",

"customer" => $customer->id,

"description" => $description));

$success = 1;

$paymentProcessor="Credit card (www.stripe)";

}

catch (Stripe_InvalidRequestError $a) {

// Since it's a decline, Stripe_CardError will be caught

$error3 = $a->getMessage();

}

catch (Stripe_Error $e) {

// Since it's a decline, Stripe_CardError will be caught

$error2 = $e->getMessage();

$error = 1;

}

if ($success!=1)

{

$_SESSION['error3'] = $error3;

$_SESSION['error2'] = $error2;

header('Location: checkout.php');

exit();

}

问题是有时卡有错误(我那里没有“捕获”参数捕获),“尝试”失败,页面立即在屏幕上显示错误,而不是进入“ if”和重定向回checkout.php。

我应该如何构建我的错误处理的结构,以便得到错误并立即重定向回checkout.php并在其中显示错误?

谢谢!

引发错误:

Fatal error: Uncaught exception 'Stripe_CardError' with message 'Your card was declined.' in ............

/lib/Stripe/ApiRequestor.php on line 92

===============>>#5 票数:8

在网站上测试STRIPE的过程中,我构建了如下代码:

try {

$charge = Stripe_Charge::create(array(

"amount" => $clientPriceStripe, // amount in cents

"currency" => "usd",

"customer" => $customer->id,

"description" => $description));

$success = 1;

$paymentProcessor="Credit card (www.stripe)";

}

catch (Stripe_InvalidRequestError $a) {

// Since it's a decline, Stripe_CardError will be caught

$error3 = $a->getMessage();

}

catch (Stripe_Error $e) {

// Since it's a decline, Stripe_CardError will be caught

$error2 = $e->getMessage();

$error = 1;

}

if ($success!=1)

{

$_SESSION['error3'] = $error3;

$_SESSION['error2'] = $error2;

header('Location: checkout.php');

exit();

}

问题是有时卡有错误(我那里没有“捕获”参数捕获),“尝试”失败,页面立即在屏幕上显示错误,而不是进入“ if”和重定向回checkout.php。

我应该如何构建我的错误处理的结构,以便得到错误并立即重定向回checkout.php并在其中显示错误?

谢谢!

引发错误:

Fatal error: Uncaught exception 'Stripe_CardError' with message 'Your card was declined.' in ............

/lib/Stripe/ApiRequestor.php on line 92

===============>>#6 票数:2

在网站上测试STRIPE的过程中,我构建了如下代码:

try {

$charge = Stripe_Charge::create(array(

"amount" => $clientPriceStripe, // amount in cents

"currency" => "usd",

"customer" => $customer->id,

"description" => $description));

$success = 1;

$paymentProcessor="Credit card (www.stripe)";

}

catch (Stripe_InvalidRequestError $a) {

// Since it's a decline, Stripe_CardError will be caught

$error3 = $a->getMessage();

}

catch (Stripe_Error $e) {

// Since it's a decline, Stripe_CardError will be caught

$error2 = $e->getMessage();

$error = 1;

}

if ($success!=1)

{

$_SESSION['error3'] = $error3;

$_SESSION['error2'] = $error2;

header('Location: checkout.php');

exit();

}

问题是有时卡有错误(我那里没有“捕获”参数捕获),“尝试”失败,页面立即在屏幕上显示错误,而不是进入“ if”和重定向回checkout.php。

我应该如何构建我的错误处理的结构,以便得到错误并立即重定向回checkout.php并在其中显示错误?

谢谢!

引发错误:

Fatal error: Uncaught exception 'Stripe_CardError' with message 'Your card was declined.' in ............

/lib/Stripe/ApiRequestor.php on line 92

===============>>#7 票数:0

在网站上测试STRIPE的过程中,我构建了如下代码:

try {

$charge = Stripe_Charge::create(array(

"amount" => $clientPriceStripe, // amount in cents

"currency" => "usd",

"customer" => $customer->id,

"description" => $description));

$success = 1;

$paymentProcessor="Credit card (www.stripe)";

}

catch (Stripe_InvalidRequestError $a) {

// Since it's a decline, Stripe_CardError will be caught

$error3 = $a->getMessage();

}

catch (Stripe_Error $e) {

// Since it's a decline, Stripe_CardError will be caught

$error2 = $e->getMessage();

$error = 1;

}

if ($success!=1)

{

$_SESSION['error3'] = $error3;

$_SESSION['error2'] = $error2;

header('Location: checkout.php');

exit();

}

问题是有时卡有错误(我那里没有“捕获”参数捕获),“尝试”失败,页面立即在屏幕上显示错误,而不是进入“ if”和重定向回checkout.php。

我应该如何构建我的错误处理的结构,以便得到错误并立即重定向回checkout.php并在其中显示错误?

谢谢!

引发错误:

Fatal error: Uncaught exception 'Stripe_CardError' with message 'Your card was declined.' in ............

/lib/Stripe/ApiRequestor.php on line 92

ask by samyb8 translate from so

更多推荐

php可以捕捉内存溢出吗,php - 使用Try / Catch PHP方法捕获条带错误 - 堆栈内存溢出...

本文发布于:2023-06-14 07:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1451492.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内存   条带   堆栈   错误   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!