可以将以下数组转换为下面的字符串......
$eventsfilters = array(
'language' => $languagePath,
'page' => 1,
'limit' => 9,
'start_date' => time()
);
进入这个:
$ajax_filter = "'language': '" . $languagePath . "', 'page': 1, 'limit': 9, 'start_date': " . time();
然后进入ajax数据过滤器。
答案 0 :(得分:1)
如果它正在通过AJAX过滤器,它可能需要采用JSON格式。您发布的字符串无效json。最好将数组传递给json_encode。
$ajax_filter = json_encode($eventsfilters);
哪会返回这样的内容:
{"language":"languagePath","page":1,"limit":9,"start_date":1412241074}
答案 1 :(得分:0)
试试以下代码:
$eventsfilters = array(
'language' => "sdfsd",
'page' => 1,
'limit' => 9,
'start_date' => time()
);
foreach($eventsfilters as $key => $val){
$arr[] = "'$key':".$val;
}
$arr = implode(",", $arr);
echo $arr;