AngularJS在SQLite DB上发布,PHP内部错误为500

AngularJS在SQLite DB上发布,PHP内部错误为500,php,angularjs,Php,Angularjs,我正在AngularJS中构建一个应用程序,使用SQLite作为本地数据库。连接是由PHP实现的。我可以读取数据,我可以添加数据,但当我想删除数据时,我会收到500个内部错误。以下代码是我在项目中使用的代码 app.js $scope.remove = function() { var removeIds = helperFactory.filterFiledArrayByDone($scope.items, 'id', 1); if (removeIds.le

我正在AngularJS中构建一个应用程序,使用SQLite作为本地数据库。连接是由PHP实现的。我可以读取数据,我可以添加数据,但当我想删除数据时,我会收到500个内部错误。以下代码是我在项目中使用的代码

app.js

$scope.remove = function() {
        var removeIds = helperFactory.filterFiledArrayByDone($scope.items, 'id', 1);

        if (removeIds.length > 0) {
            $http({

                method : 'POST',
                url : urlRemove,
                data : "ids=" + removeIds.join('|'),
                headers : {'Content-Type' : 'application/x-www-form-urlencoded'}

            })
                .success(function(data){
                    if (_recordRemovedSuccessfully(data)){
                        $scope.items = $scope.items.filter(function(item) {
                            return item.done == 0;
                        });
                    }
                })
                .error(function(data, status, headers, config){
                    throw new Error('Something went wrong with removing')
                });
        }
    };
remove.php

<?php

try {

    if (empty($_POST['ids'])) {
        throw new PDOException("Invalid Request";
    }

    $ids = $_POST['ids'];
    $idsArray = explode('|', $ids);
    $placeholders = implode(', ', array_fill(0, count($idsArray), '?'));

    $objDb = new PDO('sqlite:../database/database');
    $objDb->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    $sql = "DELETE FROM 'items'
            WHERE 'id' IN ({$placeholders})";

    $statement = $objDb->prepare($sql);

    if (!$statement->execute($idsArray)) {
        throw new PDOException("The execute method failed");
    }

    echo json_encode(array(
        'error' => false

        ), JSON_HEX_TAG| JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);

} catch(PDOException $e){
    echo json_encode(array(
        'error' => true,
        'message' => $e->getMessage()
        ), JSON_HEX_TAG| JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);
}

有人知道如何解决这个问题吗?

也许我错了,这不是问题所在,但你在这里遗漏了一个:

if (empty($_POST['ids'])) {
    throw new PDOException("Invalid Request";
}
angular.js:9866 POST http://localhost:8888/mod/remove.php 500 (Internal Server Error)
angular.js:11655 Error: Something went wrong with removing
    at app.js:199
    at angular.js:9415
    at processQueue (angular.js:13248)
    at angular.js:13264
    at Scope.$get.Scope.$eval (angular.js:14466)
    at Scope.$get.Scope.$digest (angular.js:14282)
    at Scope.$get.Scope.$apply (angular.js:14571)
    at done (angular.js:9698)
    at completeRequest (angular.js:9888)
    at XMLHttpRequest.requestLoaded (angular.js:9829)
if (empty($_POST['ids'])) {
    throw new PDOException("Invalid Request";
}