26
2019.2
初始操作
作者: POPASP
系统会检测当前模块是否具有初始操作,如果存在就会按照顺序执行,初始操作的方法名是initialize,可以在配置文件中进行更改。
比如:
```brush:vb
<%
Class User
Sub initialize
if isEmpty( session("admin") ) Then
call that.redirect( "login.asp" )
end If
End Sub
sub other
'......
end sub
End Class
%>
```
在User控制器中定义了方法initialize,在访问
```brush:xml
http://serverName/index.asp?c=User&a=other
'或者通过A_函数来操作
Call A_("User/other")
```
时首先会调用一次initialize方法。