【问题标题】:How to retireve data from array php [duplicate]如何从数组php中检索数据[重复]
【发布时间】:2019-04-13 09:25:59
【问题描述】:

当我使用我的代码时:

接下来的数据会是这样的

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 arrays key


【解决方案1】:

很简单。以下是你的做法:

<?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' => '&#x2022; 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>

【讨论】:

    猜你喜欢
    • 2021-08-18
    • 1970-01-01
    • 2012-10-23
    • 1970-01-01
    • 2017-02-11
    • 2019-05-01
    • 2013-07-06
    • 2013-10-15
    • 2016-02-24
    相关资源
    最近更新 更多