Asp深度揭密(上)

來源:互聯網
上載者:User
一、Asp基本知識
1.Asp是Active Server Pages的簡稱,是解釋型的指令碼語言環境;
2.Asp的運行需要Windows作業系統,9x下需要安裝PWS;而NT/2000/XP則需要安裝Internet Information Server(簡稱IIS);
3.Asp和JSP的指令碼標籤是“<%%>”,PHP的則可以設定為多種;
4.Asp的注釋符號是“'”;
5.使用附加組件,可以擴充Asp的功能。
例子:
HelloWorld_1.asp
<%="Hello,world"%>
效果:
Hello,world
HelloWorld_2.asp
<%
for i=1 to 10
response.write "Hello,world"
next
%>
效果:
Hello,world
Hello,world
Hello,world
Hello,world
Hello,world
Hello,world
Hello,world
Hello,world
Hello,world
Hello,world
注意:Asp不區分大小寫;變數無需定義也可使用,轉換方便;語法檢查很松。
二、Asp內建對象的使用:
可以使用下面的任何ASP內建對象,而不必在ASP指令碼中特別聲明。
1. Request:
定義:可用來訪問從瀏覽器發送到伺服器的請求資訊,可用此對象讀取已輸入HTML表單的資訊。
集:
Cookies:含有瀏覽器cookies的值
Form:含有HTML表單域中的值
QueryString:含有查詢字串的值
ServerVariables:含有頭和環境變數中的值
例子:
request_url.asp
<%
'擷取使用者輸入,並存入變數
user_id=request.querystring("user_id")
user_name=request.querystring("user_name")
'判斷使用者輸入是否正確
if user_id="" then
response.write "User_id is null,please check it"
response.end
end if
if user_name="" then
response.write "User_name is null,please check it"
response.end
end if
'列印變數
response.write user_id&"<br>"
response.write user_name
%>
效果:
當訪問http://10.1.43.238/course/request_url.asp?user_name=j時:
User_id is null,please check it
當訪問http://10.1.43.238/course/request_url.asp?user_name=j&user_id=my_id時:
my_id
j
思考:變數是如何在URL中傳遞和被Asp頁面擷取的?
request_form.htm

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.