我想使用codeigniter在[{}]
大括号内的数据库中存储一个数组。现在,当我将数据存储在数组中时,这些存储就像{}
一样。我使用了以下代码:
$addresses = array();
foreach ($langs as $lang=>$long_name)
{
$addresses[$lang] = $this->input->post('address_'.$lang);
$meta_search_text .= $titles[$lang].' ';
$meta_search_text .= $addresses[$lang].' ';
}
$data['address'] = json_encode($addresses); //store data in address column
输出:
{"en":"pune","es":"","ru":"","ar":"","de":"","fr":"","it":"","pt":"","tr":"","hi":"","bn":""}
我希望它像:
[{"en":"pune","es":"","ru":"","ar":"","de":"","fr":"","it":"","pt":"","tr":"","hi":"","bn":""}]