Я попытался взорвать возвращенный массив, и он просто не хочет отображать. Очевидно, я делаю что-то неправильно. Вот код для бит, в котором у меня возникла проблема с взломом.Как взорвать этот массив?
index.php
include "class_client.php";
$client->set('place', 'home');
$client->placeLookup();
$client->screen($client->response()); //want to replace this to print the selected exploded data as shown at the bottom of this question
class_client.php
private $data = array();
private $response = NULL;
public function set($key, $value) {
$this->data[$key] = $value;
return $this;
}
private function get($key) {
return $this->data[$key];
}
public function response() {
return $this->response;
}
public function placeLookup() {
$this->response = $this->srv()->placeLookup(array('place' => $this->get('place')));
return $this;
}
Выход
stdClass Object
(
[return] => stdClass Object
(
[fields] => stdClass Object
(
[entries] => Array
(
[0] => stdClass Object
(
[key] => place.status
[value] => HERE
)
[1] => stdClass Object
(
[key] => place.name
[value] => home
)
)
)
[operation] => place.lookup
[success] => TRUE
)
)
только данные, которые я хочу видеть в выходе на index.php есть;
HERE (which comes from [value] in [0] in the entries array)
home (which comes from [value] in [1] in the entries array)
также Предпочел бы, если я могу взорваться в class_client.php и вернуть значения обратно в новый массив в index.php (минимизировать/скрыть код в index.php).
спасибо !!
Чтобы уточнить, вы хотите, чтобы '$ client-> response()' возвращал массив типа 'array ('HE RE ',' home ') '? – Kevin
@Kevin: Совершенно верно :) Спасибо за то, что он стал намного яснее – Dov