include| question one. Benefits of using include:
Make the program modular, easy to maintain, and improve the reusability, reduce the probability of error occurrence, shorten the development cycle.
Two. Use include format:
1. Relative path <!--#include file= "common.asp"--> default to the common.asp in the directory where the ASP is calling it
<!--#include file= ". /common.asp "--> The directory of the ASP where it was called common.asp
2. Absolute path
<!--#include virtual= "common.asp"--> defaults to common.asp under the root directory
<!--#include virtual= "test/common.asp" under the--> root directory under the test directory common.asp
Common.asp
function AddOne (i)
Addone=i+1
End Function
Sample.asp
<! --#include virtual= "test/common.asp"-->
<% Dim i I=1 i=addone (i)
Response.Write "U Got" &i& "points"
%>
Three. Several main points:
1. Cannot cycle call if there are a.inc and b.inc if B.inc #include a.inc then a.inc cannot #include b.inc
2. It is recommended that you do not use the default. inc suffix to use. asp, so as not to be downloaded directly by others, causing harm. 3. #include优先于asp解析, so the following procedure is wrong sample1.asp
<%
Dim i I=1 i=addone (i)
Response.Write "U Got" &i& "points"
Dim Incneed incneed=1.asp
%>
<!--#include virtual= "test/<%=incneed%>" "-->
If you use Select Case, both 1.asp and 2.asp are loaded ahead of time, but when calling a function, it seems to recognize only the last include, whether incneed=1 or 2, the answer is U got 3 points
Hope this article can play a good effect, and would like to take this to know some common interests of friends, thank you.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.