我剛剛學習..任何人都可以請告訴我如何添加變量p = 1時請設置此PayPal參數字符串。這是它在mo上的工作狀況。我只需要添加p = 1,但是我仍然認爲語法錯誤。謝謝。添加另一個變量到PayPal URL查詢字符串
paypalParameterString.Append("return=http://examplesite.com/accounts.aspx?page=" & Request.QueryString("page") & "&")
我剛剛學習..任何人都可以請告訴我如何添加變量p = 1時請設置此PayPal參數字符串。這是它在mo上的工作狀況。我只需要添加p = 1,但是我仍然認爲語法錯誤。謝謝。添加另一個變量到PayPal URL查詢字符串
paypalParameterString.Append("return=http://examplesite.com/accounts.aspx?page=" & Request.QueryString("page") & "&")
如果你想更多的參數添加到您需要的參數之間增加一個符號(&)的URL。例如
http://examplesite.com/accounts.aspx?parameter1=foo¶meter2=bar
所以,如果你想添加參數p與值1到你這上面提到的網址應該是這樣的
paypalParameterString.Append("return=http://examplesite.com/accounts.aspx?page=" & Request.QueryString("page") & "&p=1")
如果你不想硬編碼值1
paypalParameterString.Append("return=http://examplesite.com/accounts.aspx?page=" & Request.QueryString("page") & "&p=" & value)
您將需要encode您的網址,因爲它是參數的一部分。
將您的網址字符串變量
url = "http://examplesite.com/accounts.aspx?page=" & Request.QueryString("page") & "&p=1"
然後通過確保編碼它
paypalParameterString.Append("return=" & Server.UrlEncode(url))
其添加爲參數,這將(例如)轉換&爲%26
注意:如果您需要,您可以將所有內容放在同一行上
paypalParameterString.Append(Server.UrlEncode("return=http://examplesite.com/accounts.aspx?page=" & Request.QueryString("page") & "&p=1"))
試過這個,但它從PayPal返回到只是http://www.examplesite.com/accounts.aspx?page=3 – Eggybread