0
我有以下的數組:提取信息
array (size=48)
0 =>
array (size=19)
'type' => string 'house' (length=5)
'name' => string 'House Committee on Agriculture' (length=30)
'url' => string 'http://agriculture.house.gov/' (length=29)
'minority_url' => string 'http://democrats.agriculture.house.gov/' (length=39)
'thomas_id' => string 'HSAG' (length=4)
'house_committee_id' => string 'AG' (length=2)
'subcommittees' => string '' (length=0)
0 =>
array (size=4)
'name' => string 'Conservation and Forestry' (length=25)
'thomas_id' => string '15' (length=2)
'address' => string '1301 LHOB; Washington, DC 20515' (length=31)
'phone' => string '(202) 225-2171' (length=14)
1 =>
array (size=4)
'name' => string 'Commodity Exchanges, Energy, and Credit' (length=39)
'thomas_id' => string '22' (length=2)
'address' => string '1301 LHOB; Washington, DC 20515' (length=31)
'phone' => string '(202) 225-2171' (length=14)
2 =>
array (size=4)
'name' => string 'General Farm Commodities and Risk Management' (length=44)
'thomas_id' => string '16' (length=2)
'address' => string '1301 LHOB; Washington, DC 20515' (length=31)
'phone' => string '(202) 225-2171' (length=14)
3 =>
array (size=4)
'name' => string 'Livestock and Foreign Agriculture' (length=33)
'thomas_id' => string '29' (length=2)
'address' => string '1301 LHOB; Washington, DC 20515' (length=31)
'phone' => string '(202) 225-2171' (length=14)
4 =>
array (size=4)
'name' => string 'Biotechnology, Horticulture, and Research' (length=41)
'thomas_id' => string '14' (length=2)
'address' => string '1301 LHOB; Washington, DC 20515' (length=31)
'phone' => string '(202) 225-2171' (length=14)
5 =>
array (size=4)
'name' => string 'Nutrition' (length=9)
'thomas_id' => string '03' (length=2)
'address' => string '1301 LHOB; Washington, DC 20515' (length=31)
'phone' => string '(202) 225-2171' (length=14)
'address' => string '1301 LHOB; Washington, DC 20515-6001' (length=36)
'phone' => string '(202) 225-2171' (length=14)
'rss_url' => string 'http://agriculture.house.gov/rss.xml' (length=36)
'minority_rss_url' => string 'http://democrats.agriculture.house.gov/Rss.aspx?GroupID=1' (length=57)
'jurisdiction' =>
array (size=3)
0 => string 'policy and oversight of some federal agencies, and it can recommend funding appropriations' (length=90)
1 => string 'for various governmental agencies, programs, and activities, as defined by House' (length=80)
2 => string 'rules.' (length=6)
'jurisdiction_source' => string 'http://en.wikipedia.org/wiki/House_Committee_on_Agriculture' (length=59)
有一些值I需要提取到一個數組,subcomittess是lenght 0的一個字符串,但在這種情況下具有6個塊並且每個塊都是一個數組,但是,我怎樣才能獲得子合作伙伴和管轄權的信息?
我一直在這個工作幾個小時,我找不到解決方案,我會感謝您的幫助。
謝謝
此問題尚不清楚。你是什麼意思你想「獲得小組委員會和管轄權的信息」?提供你嘗試過的東西以及它失敗的例子。 – pocketfullofcheese
您是否期望'subcommittees'成爲指向一組對象的關鍵?如果是這樣,你的代碼不是這種情況。子數組本身沒有密鑰。 –
這個數組來自哪裏?如果它是你的代碼創建它,你需要在那裏尋找一個錯誤,像'$ your_array [] = $ subcommittee;'而不是'$ your_array ['subcommittees'] [] = $ subcommittee;'。 –