php 访问以数字开头或带连字符 '-' 的对象属性

$string = '{"tmallDelivery":"true","3plTiming":"false","deliveryCps":24}';
$t = json_encode($string);
$t = json_decode($t);
var_dump($t);
if($t->tmallDelivery && $t->{"3plTiming"} && !empty($t->deliveryCps))
{
echo 123;
}

{" "} 亲测可用

猜你喜欢

转载自www.cnblogs.com/zhanzhijie/p/9056309.html