我不是一個有經驗的開發人員,但我目前正在學徒,而且我的高級開發人員最近離開了我,並獨自一人前往!從GET更改爲POST
我從他那裏聽說,使用'GET'請求比'POST'更好,但是在讀完後我想切換到'POST',我唯一的問題是我有點不確定如何修改我的代碼來切換從'GET'結束。下面我已經在我們的系統中留下了一個共同的範圍。任何幫助將是偉大的
$scope.changenote=function(id,note){
note = encodeURIComponent(note);
var inserthistory = './dbscripts/solicitors/changenote.php?id=' + id + '&user=' + AppStorage.getCurrentUser().username + '¬e=' + note;
console.log(inserthistory);
$http({method: 'GET', url: inserthistory}).success(function(data) {
var historyurl = './dbscripts/solicitors/gethistory.php?ref=' + $scope.bbref;
$http({
method: 'GET',
url: historyurl
}).success(function(data) {
$scope.histnoteaddbtn = [];
$scope.history = data;
$state.go($state.current, {}, {
reload: true
});
});
swal("Saved!", "Your note has been saved!", "success")
})
}
那麼這取決於你在做什麼系統!我的意思是這是一個CMS或...?而且你不能總是把GET改成POST!有時你需要在一些功能中使用每一個!而關於安全性,POST和GET之間基本沒有什麼不同!在這兩種情況下,您必須使用準備好的查詢語句並在查詢中使用它之前檢查數據! – Soheyl
@GeomanYabes大喊?哪裏? –
** Soheyl **的評論..:D總是用'!' –