0
我已解碼的JSON對象:PHP測試的子對象爲空值
item_json:stdClass Object
(
[code] => 2013CA
[SP] => stdClass Object
(
[PID] => 1175630
[FirstName] => Kim
[LastName] => Kardashian
[DOB] => 01-02-1978
[Address1] => 12345 Kardashian Way
[Address2] =>
[Address3] =>
[City] => Hollywood
[State] => CA
[Zip] => 90210
[Country] => US
[Phone] => 1-210-5551212-
[Email] => [email protected]
[Info] => stdClass Object
(
[Declined] => null
[NameOnLicense] => KK
[State] => CA
[License] => 90210
[LicenseText] => License Number
[TypeID] => 215057
[Hours] => 24
[Units] => 24
[Price] => 0
)
)
)
如何測試,看看是否信息 - >拒絕爲空?
我已經試過
!isset($item_json-SP->Info->Declined)
和
$item_json-SP->Info->Declined == null
,但他們都失敗。
他們是如何失敗的?你期望會發生什麼,發生了什麼? – 2013-05-10 16:32:26
其實,我走了另一條路線,我真的需要檢查NameOnLicense是否爲空。我正在刪除這個問題。 – MB34 2013-05-10 16:44:31
我真的希望SO會發表一條評論通知,指出倒計時帖子的人。躲在你的「匿名」背後並不酷。 – MB34 2013-05-10 20:35:40