Ajax中的open函式小結

2021-08-20 18:23:30 字數 1013 閱讀 9619

ajax的open函式形式為open(bstrmethod, bstrurl, varasync, bstruser, bstrpassword),其中的bstrmethod通常有get和post兩種常用方式,使用get方式需要注意:

1 對於get請求(或凡涉及到url傳遞引數的),被傳遞的引數都要先經encodeuricomponent方法處理.例:var url = "update.php?username=" +encodeuricomponent(username) + "&content=" +encodeuricomponent

(content)+"&id=1" ;

使用post方式需注意:

1.abc&***=man&age=18以及var name=?abc&***=man&age=18的寫法都是錯誤的

;3.引數在send(引數)方法中傳送,例:xmlhttp.send(name); 如果是get方式,直接xmlhttp.send(null);

4.伺服器端請求引數區分get與post。如果是get方式則$username = $_get["username"]; 如果是post方式,則$username = $_post["username"];

以下是自己測試open函式的js**:

//建立xmlhttprequest物件

}//傳送引數字串

function createquerystring()

//處理get請求

python中的open函式

這裡簡單記錄一下python中的with open 函式中的引數設定 python的open方法用來開啟乙個檔案。第乙個引數是檔案的位置和檔名,第二個引數是讀寫模式。這裡我們採用w模式,也就是寫模式。在這種模式下,檔案原有的內容將會被刪除。其中對於第二個引數 ru 或 ua 以讀方式開啟,同時提供通...

Linux C中的open函式

open函式屬於linux中系統io,用於 開啟 檔案,開啟乙個檔案意味著獲得了這個檔案的訪問控制代碼。int fd open 引數1,引數2,引數3 int fd open const char pathname,int flags,mode t mode 1.控制代碼 file descript...

JS中open 函式介紹

window object.open url name features replace url 新視窗的url位址 name 新視窗的名稱,可以為空 featurse 屬性控制字串,在此控制視窗的各種屬性,屬性之間以逗號隔開。fullscreen 是否全屏,預設no channelmode 是否顯...