我有代碼,我假設一些不是數組。 我嘗試使用循環foreach,但它無效。 我提取序列化數據的代碼,如何提取這個數組?
array (
'last_submit' => '1',
'feeds_changed' => '1',
'streams' => '{"id1":{"id":"1","name":"Test Stream","feeds":"[{\\"content\\":\\"testing\\",\\"id\\":\\"tm02801\\",\\"type\\":\\"facebook\\",\\"filter-by-words\\":\\"testing2\\"},{\\"content\\":\\"testing3\\",\\"id\\":\\"oe29415\\",\\"type\\":\\"instagram\\",\\"filter-by-words\\":\\"9gag\\"},{\\"content\\":\\"testing\\",\\"retweets\\":\\"nope\\",\\"replies\\":\\"nope\\",\\"id\\":\\"nq62491\\",\\"type\\":\\"twitter\\",\\"filter-by-words\\":\\"testing\\"},{\\"content\\":\\"testing\\",\\"id\\":\\"nt14171\\",\\"type\\":\\"pinterest\\"}]","posts":"40","cache":"yep","cache-lifetime":"10","private":"nope","hide-on-desktop":"nope","hide-on-mobile":"nope","heading":"Stream Demo","headingcolor":"rgb(154, 78, 141)","subheading":"","subheadingcolor":"rgb(114, 112, 114)","hhalign":"center","bgcolor":"rgb(229, 229, 229)","mobileslider":"nope","viewportin":"yep","layout":"grid","theme":"classic","gc-style":"style-4","width":"260","margin":"20","cardcolor":"rgb(255, 255, 255)","namecolor":"rgb(154, 78, 141)","textcolor":"rgb(85, 85, 85)","linkscolor":"rgb(94, 159, 202)","restcolor":"rgb(132, 118, 129)","shadow":"rgba(0, 0, 0, 0.22)","bcolor":"rgba(240, 237, 231, 0.4)","talign":"left","css":""}}',
'streams_count' => '1',
'consumer_key' => '',
'consumer_secret' => '',
'oauth_access_token' => '',
'oauth_access_token_secret' => '',
'instagram_access_token' => '',
)
,但如何在流獲得價值值波紋管?
'streams' => '{"id1":{"id":"1","name":"Test Stream","feeds":"[{\\"content\\":\\"testing\\",\\"id\\":\\"tm02801\\",\\"type\\":\\"facebook\\",\\"filter-by-words\\":\\"testing2\\"},{\\"content\\":\\"testing3\\",\\"id\\":\\"oe29415\\",\\"type\\":\\"instagram\\",\\"filter-by-words\\":\\"9gag\\"},{\\"content\\":\\"testing\\",\\"retweets\\":\\"nope\\",\\"replies\\":\\"nope\\",\\"id\\":\\"nq62491\\",\\"type\\":\\"twitter\\",\\"filter-by-words\\":\\"testing\\"},{\\"content\\":\\"testing\\",\\"id\\":\\"nt14171\\",\\"type\\":\\"pinterest\\"}]","posts":"40","cache":"yep","cache-lifetime":"10","private":"nope","hide-on-desktop":"nope","hide-on-mobile":"nope","heading":"Stream Demo","headingcolor":"rgb(154, 78, 141)","subheading":"","subheadingcolor":"rgb(114, 112, 114)","hhalign":"center","bgcolor":"rgb(229, 229, 229)","mobileslider":"nope","viewportin":"yep","layout":"grid","theme":"classic","gc-style":"style-4","width":"260","margin":"20","cardcolor":"rgb(255, 255, 255)","namecolor":"rgb(154, 78, 141)","textcolor":"rgb(85, 85, 85)","linkscolor":"rgb(94, 159, 202)","restcolor":"rgb(132, 118, 129)","shadow":"rgba(0, 0, 0, 0.22)","bcolor":"rgba(240, 237, 231, 0.4)","talign":"left","css":""}}',
看看PHPS'json_decode()'函數:HTTP ://php.net/manual/en/function.json-decode.php注意,儘管你會返回一個_object_,而不是_array_。 – arkascha
完美,謝謝 –