佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > asp仿php的一些函數(shù)分享

asp仿php的一些函數(shù)分享

熱門標(biāo)簽:銀行業(yè)務(wù) 服務(wù)器配置 團(tuán)購網(wǎng)站 Mysql連接數(shù)設(shè)置 科大訊飛語音識(shí)別系統(tǒng) Linux服務(wù)器 電子圍欄 阿里云
復(fù)制代碼 代碼如下:

'過程:輸出字符串[代替Response.Write]

Sub echo(Str)
response.Write(Str)
End Sub

'函數(shù):獲取表單[代替Request.Form]

Function reqf(Str)
reqf = Request.Form(Str)
End Function

'過程:結(jié)束頁面并輸出字符串

Sub die(Str)
response.Write(Str)
response.End()
End Sub

'函數(shù):將ASP文件運(yùn)行結(jié)果返回為字串

Function ob_get_contents(Path)
Dim tmp, a, b, t, matches, m
Dim Str
Str = file_iread(Path)
tmp = "dim htm : htm = """""vbCrLf
a = 1
b = InStr(a, Str, "%") + 2
While b > a + 1
t = Mid(Str, a, b - a -2)
t = Replace(t, vbCrLf, "{::vbcrlf}")
t = Replace(t, vbCr, "{::vbcr}")
t = Replace(t, """", """""")
tmp = tmp "htm = htm """ t """" vbCrLf
a = InStr(b, Str, "%\&;") + 2
tmp = tmp str_replace("^\s*=", Mid(Str, b, a - b -2), "htm = htm ") vbCrLf
b = InStr(a, Str, "%") + 2
Wend
t = Mid(Str, a)
t = Replace(t, vbCrLf, "{::vbcrlf}")
t = Replace(t, vbCr, "{::vbcr}")
t = Replace(t, """", """""")
tmp = tmp "htm = htm """ t """" vbCrLf
tmp = Replace(tmp, "response.write", "htm = htm ", 1, -1, 1)
tmp = Replace(tmp, "echo", "htm = htm ", 1, -1, 1)
'execute(tmp)
executeglobal(tmp)
htm = Replace(htm, "{::vbcrlf}", vbCrLf)
htm = Replace(htm, "{::vbcr}", vbCr)
ob_get_contents = htm
End Function

'過程:動(dòng)態(tài)包含文件

Sub include(Path)
echo ob_get_contents(Path)
End Sub

'函數(shù):base64加密

Function base64encode(byval Str)
If IsNull(Str) Then Exit Function
Dim base64
Set base64 = New base64_class
Str = base64.encode(Str)
Set base64 = Nothing
base64encode = Str
End Function

'函數(shù):base64解密

Function base64decode(byval Str)
If IsNull(Str) Then Exit Function
Dim base64
Set base64 = New base64_class
Str = base64.decode(Str)
Set base64 = Nothing
base64decode = Str
End Function

'函數(shù):URL加密

Function urlencode(byval Str)
If IsNull(Str) Then Exit Function
Str = server.URLEncode(Str)
urlencode = Str
End Function

'函數(shù):Escape加密

Function escape(byval Str)
If IsNull(Str) Then Exit Function
Dim i, c, a, tmp
tmp = ""
For i = 1 To Len(Str)
c = Mid(Str, i, 1)
a = ascw(c)
If (a>= 48 And a= 57) Or (a>= 65 And a= 90) Or (a>= 97 And a= 122) Then
tmp = tmp c
ElseIf InStr("@*_+-./", c) > 0 Then
tmp = tmp c
ElseIf a>0 And a16 Then
tmp = tmp "%0" Hex(a)
ElseIf a>= 16 And a256 Then
tmp = tmp "%" Hex(a)
Else
tmp = tmp "%u" Hex(a)
End If
Next
escape = tmp
End Function

'函數(shù):Escape解密

Function unescape(byval Str)
If IsNull(Str) Then Exit Function
Dim i, c, tmp
tmp = ""
For i = 1 To Len(Str)
c = Mid(Str, i, 1)
If Mid(Str, i, 2) = "%u" And i= Len(Str) -5 Then
If IsNumeric("H" Mid(Str, i + 2, 4)) Then
tmp = tmp chrw(CInt("H" Mid(Str, i + 2, 4)))
i = i + 5
Else
tmp = tmp c
End If
ElseIf c = "%" And i= Len(Str) -2 Then
If IsNumeric("H" Mid(Str, i + 1, 2)) Then
tmp = tmp chrw(CInt("H" Mid(Str, i + 1, 2)))
i = i + 2
Else
tmp = tmp c
End If
Else
tmp = tmp c
End If
Next
unescape = tmp
End Function

標(biāo)簽:萍鄉(xiāng) 江蘇 棗莊 衢州 廣元 大理 衡水 蚌埠

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp仿php的一些函數(shù)分享》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    鱼台县| 浏阳市| 通化市| 长垣县| 梓潼县| 永川市| 石家庄市| 工布江达县| 阳泉市| 日土县| 安西县| 辽阳县| 大荔县| 镇安县| 福州市| 凌云县| 思南县| 安塞县| 青岛市| 遂溪县| 崇明县| 尚志市| 交口县| 辽阳县| 布尔津县| 永嘉县| 绥芬河市| 巴青县| 徐汇区| 孝感市| 霍邱县| 丰台区| 乐都县| 鹿邑县| 乌拉特前旗| 肃宁县| 宝应县| 龙州县| 安平县| 故城县| 买车|