将ASP的Debug变得简单的两个函数![1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 fkphp 的 blog

<%
'---------------------------------------------------------------------------
'                   程序作用:打印request.form输入的所有值
'---------------------------------------------------------------------------
response.write formdata()
    function formdata()
     dim llngmaxfieldindex
     dim llngfieldindex
     dim llngmaxvalueindex
     dim llngvalueindex
     dim lstrdebug
     ' count form
     llngmaxfieldindex = request.form.count
     
     ' let user know if form do not exist
     if llngmaxfieldindex = 0 then
      formdata = "form data is empty."
      exit function
     end if
     
     ' begin building a list of all form
     lstrdebug = "<ol>"
     
     ' loop through each form
     for llngfieldindex = 1 to llngmaxfieldindex
      lstrdebug = lstrdebug & "<li>" & server.htmlencode(request.form.key(llngfieldindex))
      
      ' count the values
      llngmaxvalueindex = request.form(llngfieldindex).count
      
      ' if the field doesn't have multiple values ...
      if llngmaxvalueindex = 1 then
       lstrdebug = lstrdebug & " = "
       lstrdebug = lstrdebug & server.htmlencode(request.form.item(llngfieldindex))
      ' else loop through each value
      else
       lstrdebug = lstrdebug & "<ol>"
       for llngvalueindex = 1 to llngmaxvalueindex
        lstrdebug = lstrdebug & "<li>"
        lstrdebug = lstrdebug & server.htmlencode(request.form(llngfieldindex)(llngvalueindex))
        lstrdebug = lstrdebug & "</li>"
       next
       lstrdebug = lstrdebug & "</ol>"
      end if
      lstrdebug = lstrdebug & "</li>"
     next
     lstrdebug = lstrdebug & "</ol>"
     ' return the data
     formdata = lstrdebug
     
    end function

%>

<%
'-------------------------------------------------------------------------
'           函数功能:输出所有输入request.querystring值,用于调试!
'-------------------------------------------------------------------------

   response.write querystringdata()
    function querystringdata()
     dim llngmaxfieldindex
     dim llngfieldindex
     dim llngmaxvalueindex
     dim llngvalueindex
     dim lstrdebug
     ' count querystring
     llngmaxfieldindex = request.querystring.count
     
     ' let user know if querystring do not exist
     if llngmaxfieldindex = 0 then
      querystringdata = "querystring data is empty."
      exit function
     end if
     
     ' begin building a list of all querystring
     lstrdebug = "<ol>"
     
     ' loop through each querystring
     for llngfieldindex = 1 to llngmaxfieldindex
      lstrdebug = lstrdebug & "<li>" & server.htmlencode(request.querystring.key(llngfieldindex))
      
      ' count the values
      llngmaxvalueindex = request.querystring(llngfieldindex).count
      
      ' if the field doesn't have multiple values ...
      if llngmaxvalueindex = 1 then

本文关键:将ASP的Debug变得简单的两个函数!
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top