cakephp2-php8/lib/Cake/Test/test_app/View/Posts/json/index.ctp

14 lines
311 B
PHP

<?php
$paging = isset($this->Paginator->options['url']) ? $this->Paginator->options['url'] : null;
$formatted = array(
'user' => $user['User']['username'],
'list' => array(),
'paging' => $paging,
);
foreach ($user['Item'] as $item) {
$formatted['list'][] = $item['name'];
}
echo json_encode($formatted);