[英]Returning multidimensional array value for PHP
我要從提供者返回數據,提供的數組如下所示:
Array
(
[result] => Array
(
[0] => Array
(
[problem_id.u_root_cause] =>
[number] => INC0000001
[short_description] => Unable to print
[u_alert_check] =>
[u_business_service] => Array
(
[display_value] => Printer
[link] => https://redacted/37bc8af837c3820ca7e3b15ec3990e1c
)
[assignment_group] => Array
(
[display_value] => Printer Support
[link] => https://redacted/b699595c37dac200a7e3b15ec3990eb1
)
[u_service_impact_duration] => 57 Minutes
[u_summary_notes] => Changed USB cable
[u_environment] => Production (PD)
[problem_id] =>
[priority] => 3 - P3
[u_business_services_impacted] =>
)
現在,我可以像這樣返回大部分數據,
foreach($data['result'] as $line){
echo $line['number'];
echo '<br>';
echo $line['short_description'];
}
以上從數組中返回number
和short_description
。
我遇到的麻煩是如何在同一行中返回u_business_service
?
要訪問多維數組,您可以使用:
echo $line['u_business_service']['display_value'];
echo $line['u_business_service']['link'];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.