Php Ajax请求Post-no函数

Php Ajax请求Post-no函数,php,jquery,angularjs,ajax,Php,Jquery,Angularjs,Ajax,我有一个简单的问题,但找不到错误。也许你能帮忙。这是我的要求: $http({ url:'api/create_plane.php', method: "POST", data: { planeKey: $scope.editKey, planeSQLID: $scope.editSQLID, planeLMID: $scope.editLMID, planeAFID: $scope.editAFID,

我有一个简单的问题,但找不到错误。也许你能帮忙。这是我的要求:

$http({
    url:'api/create_plane.php',
    method: "POST",
    data: {
        planeKey: $scope.editKey,
        planeSQLID: $scope.editSQLID,
        planeLMID: $scope.editLMID,
        planeAFID: $scope.editAFID,
        planeVersion: $scope.editVersion,
        planeLot: $scope.editLot,
        planeStation: $scope.editStation                   
    },
    dataType: 'json'
}).success(function(data, status, headers, config) {
    console.log(data);
}, function(response) {
    console.log(response);
});
这是我的Php文件:

$Planes = array();
$MAX_PLANES = 45;

if (empty($_POST['planeLMID'])) {
    for ($i = 1;$i < $MAX_PLANES;$i++) {
        if (checkSQL($i)) {
            $Planes[$i] = new createPlane($i,$db);
        }
    }
    echo json_encode($Planes);   
}
else {
    for ($i = 1;$i < $MAX_PLANES; $i++) {
        if ($Planes[$i]['planeSQLID'] == $_POST['planeSQLID']) {
            echo "HALLO";
        }   
    }
}
$Planes=array();
$MAX_平面=45;
if(空($_POST['planeLMID'])){
对于($i=1;$i<$MAX_平面;$i++){
if(checkSQL($i)){
$Planes[$i]=新的createPlane($i,$db);
}
}
echo json_编码($Planes);
}
否则{
对于($i=1;$i<$MAX_平面;$i++){
如果($Planes[$i]['planeSQLID']=$\u POST['planeSQLID'])){
回声“哈罗”;
}   
}
}

但是我在任何时候都看不到“你好”。我需要你们的帮助。

create\u plane.php文件中,当$\u POST['planeLMID']为空时,您试图使用空的$Planes数组

因此,无论是否通过POST接收数据,每次都需要获取$Planes数组。 请参见修改的创建平面.php

$Planes = array();
$MAX_PLANES = 45;

for ($i = 1;$i < $MAX_PLANES;$i++) {
    if (checkSQL($i)) {
        $Planes[$i] = new createPlane($i,$db);
    }
}
echo json_encode($Planes);   

if(!empty($_POST['planeLMID'])) {
    for ($i = 1;$i < $MAX_PLANES; $i++) {
        if ($Planes[$i]['planeSQLID'] == $_POST['planeSQLID']) {
            echo "HALLO";
        }   
    }
}
$Planes=array();
$MAX_平面=45;
对于($i=1;$i<$MAX_平面;$i++){
if(checkSQL($i)){
$Planes[$i]=新的createPlane($i,$db);
}
}
echo json_编码($Planes);
如果(!空($_POST['planeLMID'])){
对于($i=1;$i<$MAX_平面;$i++){
如果($Planes[$i]['planeSQLID']=$\u POST['planeSQLID'])){
回声“哈罗”;
}   
}
}

else
案例
中,$Planes
是空的,在我来到空的平面之前,我收到了json编码的回音,您在另一个查询中收到了您的
回音json
您做了哪些调试?到目前为止,您采取了哪些步骤来解决此问题?没有,控制台中只有1个输出,这是上面的console.log(数据)