ASP can dynamically include files

xiaoxiao2021-03-06  47

ASP can dynamically include files <% 'to get the province's province DIM province province = request.form ("province)' below shows the province's related information%> "-> Do you think that the above code works? Do not! Simply use ASP to achieve dynamic, you can't reach the effect you want. why? Because: The include command is executed before the ASP code, so the above code does not follow the author's will, first get the province's province, then contain information about this province! If you really need to be dynamic, you can do this: <% SELECT CASE Provincecase 1:%> It should be said that this code can get the result you want. However, because your users may come from 33 provinces, do you include 33 files? In particular, SSINC.DLL does not know which containment you need (in fact, this time the province has no value), so she contains all the files! You can imagine, how big this time is this! Then, asp.dll will scan the ASP code in this file and then execute! So, whenever this time, you should consider other ideas, such as databases, or FileSystemObject. How to dynamically include file? One of the biggest challenges that ASP programmers often face is the dynamic incrude file. Since #include is processed before the ASP code is executed, it seems that the brain of IF / ELSE is impossible. Is this like this? Depending on the purpose of your use of incrude, and you will use IF / ELSE to solve the problem using IF / ELSE. But this is definitely not at any time, and it is not an effective solution because you need to do a lot of manual work. Suppose there are two sample htm files, 1.HTM and 2.HTM, for simplicity, assume that the contents of the file are as follows: this is IS 1.HTM < / font> this is 2.htm Now let's try the dynamic include: <% if request.queryString ('param') = '2' Then%> <% else%> <% end if%> please Note: The above two #includes are actually processed.

转载请注明原文地址:https://www.9cbs.com/read-109935.html

New Post(0)