AJAX提交数据到后台,PHP无法获取POST数据的解决办法

2017-04-07 [已注销]
1.
$.ajax({
    type: "POST",
    url: "api/GameAjax/getLuckyGift",
    data: {openid: $("#openid").val(), rid: $("#rid").val()},
    success: function (data) {
    }
});

无法获取$_POST


2.

$.ajax({
    type: "POST",
    url: "api/GameAjax/getLuckyGift/index.php",
    data: {openid: $("#openid").val(), rid: $("#rid").val()},
    success: function (data) {
    }
});
url加上具体index.php路径后,能获取$_POST