Я подключаюсь к API, используя запрос GET. Когда я var_dump
массив в JSON, я получаю полный массив, и я просто хочу получить некоторые значения, такие как «электронная почта».Как эхо одной переменной массива в PHP?
Это ответ:
{
["communication"]=> array(12) {
["@id"]=> string(8) "84730060"
["@uri"]=> string(63) "https://gethope.fellowshiponeapi.com/v1/Communications/84730060"
["household"]=> array(2) {
["@id"]=> string(8) "46312207"
["@uri"]=> string(59) "https://gethope.fellowshiponeapi.com/v1/Households/46312207"
}
["person"]=> array(2) {
["@id"]=> string(8) "75977434"
["@uri"]=> string(55) "https://gethope.fellowshiponeapi.com/v1/People/75977434"
}
["communicationType"]=> array(3) {
["@id"]=> string(1) "4"
["@uri"]=> string(75) "https://gethope.fellowshiponeapi.com/v1/Communications/CommunicationTypes/4"
["name"]=> string(5) "Email"
}
["communicationGeneralType"]=> string(5) "Email"
["communicationValue"]=> string(19) "[email protected]"
["searchCommunicationValue"]=> string(19) "[email protected]"
["preferred"]=> string(4) "true"
["communicationComment"]=> NULL
["createdDate"]=> string(19) "2015-11-17T13:30:24"
["lastUpdatedDate"]=> string(19) "2016-02-02T14:08:22"
}
}
Пожалуйста, исправьте код. У вас есть правильный путь, который не равен чему-либо прямо перед выражением эха, и гораздо больше ошибок в вашем объяснении. – Webeng
Можете ли вы понять, что вы ожидаете. –