当连接字符串时,ASP 等同于 PHP 的 .=
是什么?我指的是 asp 而不是 asp.net。
我的意思是指定我在 for 循环中。所以我想知道 .=
(在 php 中)的等价物,而不是标准连接。
示例:
For Each Item In Request.Form
If (Item = "service") then
For x=1 To Request.Form(item).Count
service = "&service="&Request.Form(Item)(x)
Next
End If
Next
最佳答案
在 VBScript 中:
Variable = Variable & "something more"
在 JScript 中我相信你可以使用:
variable += "something more";
具体来说:
service = service & "&service=" & Request.Form(Item)(x)
假设您希望结果看起来像...
&service=blah1&service=blah2&service=blah3
虽然您可能需要对您的 Request.Form(Item)(x) 值进行 URL 编码,因为任何“&”(和其他字符)都可能会搞砸您正在尝试做的事情。直接从 HTML 表单使用未经过滤的输入时也要小心,这非常危险。
关于php - ASP 中是否有用于附加到字符串变量的运算符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/203425/