当我从我的模型中得到一个数组时,就像这样
function get_sites() {
echo json_encode($data['usersites'] = $this->usersites_model->get_user_sites($this->session->userdata('account_id')));
}
这完全发送到我的视图,除了我在数组中有一个URL,我需要在将其发送到视图之前进行urldecode。
如何在发送之前编辑数组呢?
我试过了
function get_sites() {
$data['usersites'] = $this->usersites_model->get_user_sites($this->session->userdata('account_id'));
$data['usersites'] = array (
$data['site_id'] = 'site_id',
$data['site_title'] = 'site_title',
$data['site_url'] = urldecode('site_url'),
$data['site_description'] = 'site_description',
$data['site_category'] = 'site_category'
);
echo json_encode($data);
}
和
function get_sites() {
$data['usersites'] = $this->usersites_model->get_user_sites($this->session->userdata('account_id'));
$data['site_id'] = 'site_id';
$data['site_title'] = 'site_title';
$data['site_url'] = urldecode('site_url');
$data['site_description'] = 'site_description';
$data['site_category'] = 'site_category';
echo json_encode($data);
}