php - 如何从数组php中检索数据
问题描述
当我使用我的代码时:
即将到来的数据会是这样的
Array
(
[name] => Facebook
[author] => Facebook
[physicalAddress] => 1 Hacker Way\nMenlo Park, CA 94025
[supportEmail] => android-support@fb.com
[supportUrl] => https://www.facebook.com/facebook
[category] => Social
[storeCategory] => SOCIAL
[price] => 0
[changelog] => • Improvements for reliability and speed
[datePublished] => April 11, 2019
[datePublishedIso] => 2019-04-11T00:00:00Z
[fileSize] => Varies with device
[numDownloads] => 1,000,000,000+
[versionName] => Varies with device
[operatingSystems] => Varies with device
[contentRating] => Parental guidance
)
我想单独获取数据
喜欢
姓名、作者等
我该怎么办?
解决方案
很简单。这是您的操作方法:
<?php
$details = array(
'name' => 'Facebook',
'author' => 'Facebook',
'physicalAddress' => '1 Hacker Way\nMenlo Park, CA 94025',
'supportEmail' => 'android-support@fb.com',
'supportUrl' => 'https://www.facebook.com/facebook',
'category' => 'Social',
'storeCategory' => 'SOCIAL',
'price' => '0',
'changelog' => '• Improvements for reliability and speed',
'datePublished' => 'April 11, 2019',
'datePublishedIso' => '2019-04-11T00:00:00Z',
'fileSize' => 'Varies with device',
'numDownloads' => '1,000,000,000+',
'versionName' => 'Varies with device',
'operatingSystems' => 'Varies with device',
'contentRating' => 'Parental guidance',
);
?>
<p><strong>Name: </strong><?php echo $details['name']; ?></p>
<p><strong>Author: </strong><?=$details['author']; ?></p>
<p><strong>Date Published ISO: </strong><?php echo $details['datePublishedIso']; ?></p>
推荐阅读
- c++ - 这个 C++ 代码发生了什么?为什么sua = 20?
- mysql - 三个表的join和group_concat
- javascript - 单选项卡多内容引导程序 4
- mariadb - Galera Cluster:每晚 5:30 神秘不同步
- 3d - Vulkan 或金属或任何这些图形“API”到底是什么?
- entity-framework - 实体核心插入添加重复行
- python - 直方图的全局和局部最大值
- jetty - 为在反向代理后面运行的 ActiveMQ Web 控制台配置基本 URL
- php - 如何循环遍历这个 POST 数组?
- python - 如何在python中使用颜色图?