这感觉就像一个非常愚蠢的问题,但我一直想知道我是否一直在做错:
if($payment->shipping_state OR $payment->shipping_province)
{
$request['SHIPTOSTATE'] = isset($payment->shipping_state) ? $payment->shipping_state : $payment->shipping_province;
}
是否有关键字/更简单的方法将$request['SHIPTOSTATE']
设置为存在的变量,因为我已经确认其中一个确实存在?
类似的东西:
if ($payment->shipping_state OR $payment->shipping_province)
{
$var = $this;
}
答案 0 :(得分:0)
$data = (!empty($payment->shipping_state))?$payment->shipping_state:$payment->shipping_province;
if (!empty($data))
$request['SHIPTOSTATE'] = $data;