这是我的PHP代码
http_response_code(404);
$message = http_response_code()." No data found";
header('Content-Type: application/json');
echo json_encode($message);
这是我的AngularJS代码
app.controller('customersCtrl', function($scope, $http) {
$scope.element = function(num){
var element_id = num;//num;
$http.get("customers.php",{params:{"id":element_id}}).then(function (response) {
$scope.myData = response.data;
}
,function errorCallback(response){
$scope.error=response.data;
});
};
});
如何返回404代码,或至少加载新页面以显示它?