为什么Codeigniter无法正常工作?

在控制器ajax中:

function get_class_posts()
{
echo json_encode($this->input->get());
}

直接从Chrome控制台行中浏览:

$.get("/ajax/get_class_posts",{user_id:2},function(data){window.vv = data})

RESPONSE >> OBJECT

window.vv

RESPONSE >> "{"\/ajax\/get_class_posts":""}"

当我执行$.post(...)和$this->input->post()时,它可以正常工作(即返回 user_id:2)。

Have you allowed the GET array to pass in Codeigniter. In your config/config.php make sure you have ...

$config['allow_get_array'] = TRUE;

Otherwise you will not have the GET variables.