Php 语法错误:意外';其他';
我是一名PHP新手,遇到以下错误: 解析错误:语法错误,第33行的/home/stripeparse/example.com/create_customer.php中出现意外的“else”(T_else)Php 语法错误:意外';其他';,php,stripe-payments,Php,Stripe Payments,我是一名PHP新手,遇到以下错误: 解析错误:语法错误,第33行的/home/stripeparse/example.com/create_customer.php中出现意外的“else”(T_else) <?php require_once('/Stripe/lib/Stripe.php'); Stripe::setApiKey("APIKEY"); try { Stripe_Customer::create( array( "description" =
<?php
require_once('/Stripe/lib/Stripe.php');
Stripe::setApiKey("APIKEY");
try
{
Stripe_Customer::create( array(
"description" => $mobile,
"email" => $email
));
$SUCCESS = 'SUCCESS';
$response = json_encode(array('result'=>'SUCCESS','customerID'=>$customer->id));
array_push($jsonarray, $response);
}
catch (Exception $e)
{
$response = $e -> getMessage();
array_push($jsonarray,$response);
}
else
{
$response = json_encode(array('result' => 'DATA = FALSE'))
}
print_r($response);
?>
我做错了什么
提前感谢您的帮助。您之所以会出现此错误,是因为您将语句放在了语句后面。语句只能放在or语句后面。随机else条件
else
{
$response = json_encode(array('result' => 'DATA = FALSE'))
}
只用
$response = json_encode(array('result' => 'DATA = FALSE'))
else
需要一个if
…从代码中删除else或添加if语句try/catch/else
不是有效的构造。。。。您的意思是try/catch/finally
?else
不带if
?您希望else
始终运行,还是仅当catch
未触发时才运行?