|
index.asp
- <!--#include file="../popasp_2.0/popasp.asp"-->
- <%
- '项目部署时不要手工去创建home文件夹,系统会自动创建该文件夹
- const APP_PATH = "./home"
- '项目部署的时候使用POP_MVC.start方法,项目部署完之后使用POP_MVC.run方法
- POP_MVC.run
- %>
- <%
- Call A_("Index/index")
- dim key,item
- %>
- <html>
- <head>
- <title>变量类型转化</title>
- </head>
- <body>
- <ul>
- <% for each key in V_("list") : set item = V_("list")(key) %>
- <li><a href="post.asp?id=<%=item("id")%>"><%=item("title")%></a></li>
- <% next %>
- </ul>
- </body>
复制代码
arr.asp
- <!--#include file="../popasp_2.0/popasp.asp"-->
- <%
- '项目部署时不要手工去创建home文件夹,系统会自动创建该文件夹
- const APP_PATH = "./home"
- '项目部署的时候使用POP_MVC.start方法,项目部署完之后使用POP_MVC.run方法
- POP_MVC.run
- %>
- <%
- Call A_("Index/arr")
- dim key,item
- %>
- <html>
- <head>
- <title>变量类型转化</title>
- </head>
- <body>
- <ul>
- <% for each item in V_("a") %>
- <li><%=item%></li>
- <% next %>
- <hr>
-
- <% for each key in V_("b") : item = V_("b")(key) %>
- <li><span><%=key%></span>:<span><%=item%></span></li>
- <% next %>
- </ul>
- </body>
- </html>
复制代码
IndexAction.class.asp
- <%
- ' 本类由系统自动生成,仅供测试用途
- Class IndexAction
- public Sub index()
- dim rs
-
- '在这里获取到的rs为Recordset对象
- set rs = M_("post").db.page( "null,10" ).field("id,title").select()
-
- '能过that.assign分配Recordset对象类型的变量时,会转化为Dictionary类型
- that.assign "list",rs
-
- var_export typename( V_("list") )
- end Sub
-
- public sub post
- dim rs
-
- '在这里获取到的rs为Recordset对象
- set rs = M_("post").db.fieldRev("content").find()
-
- that.assign "row",rs
-
- var_export M_("post")
- end sub
-
- public sub arr
- dim a,b
-
- a = POP_MVC.Arr.Range(5,15) '定义5-15的一维数组
-
- that.assign "a",a
- var_export typename( V_("a") )
-
- '将数组转化成Dictionary对象之后,键值为0,1,2...,也就是原数组的下标
- that.assign "b",POP_MVC.Arr.toDict( a )
-
-
- end sub
- End Class
- %>
复制代码
|
|