我有訪問數組中的值麻煩值,數組看起來像這樣,PHP的foreach從數組
Array
(
[0] => Array
(
[id] => 1661
[code] => 849651318
[job_status] => 4
[looking_for] => Lorem ipsum
[keywords_education] => Derby University
[sector_id_csv] => 10,21,9,22,26
[last_job_title_1] => Programmer
[last_job_employer_1] => HBOS
[city] => Bury
[expected_salary_level] => LEVEL_2
[education_level] => COLLEGE
[job_looking_for] =>
[is_contract] => Y
[is_permanent] => N
[is_temporary] => Y
)
)
Array
(
[0] => Array
(
[id] => 402
[code] => 849650059
[job_status] => 3
[looking_for] => Lorem ipsum
[keywords_education] => Paris College
[sector_id_csv] => 27,22,19,21,12
[last_job_title_1] => Programmer
[last_job_employer_1] => HSBC
[city] => Bury
[expected_salary_level] => LEVEL_2
[education_level] => COLLEGE
[job_looking_for] =>
[is_contract] => N
[is_permanent] => Y
[is_temporary] => Y
)
)
Array
(
[0] => Array
(
[id] => 1653
[code] => 849651310
[job_status] => 3
[looking_for] => Lorem ipsum
[keywords_education] => Crewe University
[sector_id_csv] => 27,15,19,21,24
[last_job_title_1] => Programmer
[last_job_employer_1] => ICI
[city] => Bury
[expected_salary_level] => LEVEL_2
[education_level] => UNIVERSITY
[job_looking_for] =>
[is_contract] => N
[is_permanent] => Y
[is_temporary] => Y
)
)
我試圖獲取值的時候,我曾嘗試做以下,
foreach ($result as $rslt) {
echo $rslt->id;
}
我也試過,
foreach ($result as $rslt) {
$rslt['id'];
}
但這一切作品,我不知道爲什麼,誰能幫助?
我在評論5年後,那該怎麼辦? – 2016-03-24 12:52:27