.Net的System.Web.HttpUtility类定义了以下函数来将查询字符串解析为NameValueCollection:
public static NameValueCollection ParseQueryString(string query);
Run Code Online (Sandbox Code Playgroud)
是否有任何功能可以反向(即将a NameValueCollection转换为查询字符串)?
比如,我们有一个如下所示的查询字符串:
"param1:'test1' && param2:'test2'"
Run Code Online (Sandbox Code Playgroud)
我想把它变成一个对象图,像这样:
{param:test1, param2:test2}
Run Code Online (Sandbox Code Playgroud)
怎么可能这样呢?这似乎是一个非常常见的用例.
我一直在谷歌上搜索从URL读取参数值的方法,但没有成功.在ASP.NET Webform中,我们曾经使用Request.Querystring ["name"]来获取值.如何在MVC3中执行此操作?
我需要在HtmlHelper类中访问参数.有人请.
互联网上没有明确的答案.奇怪...
有没有人知道通过查询字符串参数禁用Facebook的移动浏览器检测和重定向功能的方法?
例如,如果我在移动浏览器中访问www.facebook.com/CraigslistGenie,我会被重定向到http://m.facebook.com/CraigslistGenie.我希望用户留在页面的www版本上.
我已经完成了(不那么有帮助的)PayPal文档,但找不到这个问题的简单答案.当用户从PayPal返回时,URL不包含查询字符串,因此我没有收到'tx'值(或任何其他值).
这是我发送给PayPal的一个例子:
<form accept-charset="utf-8" action="https://www.sandbox.paypal.com/au/cgi-bin/webscr" id="paypal-form" method="post">
<input type="hidden" name="business" value="dallas_bus@dallasjclark.com">
<input type="hidden" name="cancel_return" value="http://localhost/checkout">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="custom" value="155">
<input type="hidden" name="lc" value="AU">
<input type="hidden" name="notify_url" value="http://localhost/paypal-ipn">
<input type="hidden" name="return" value="http://localhost/checkout">
<input type="hidden" name="item_name" value="ABC Company - Order #155">
<input type="hidden" name="item_number" value="155">
<input type="hidden" name="amount" value="8.95">
<input type="hidden" name="discount_amount" value="0.00">
<input type="hidden" name="shipping" value="25.00">
<input type="image" src="https://www.paypal.com/en_AU/i/btn/btn_buynowCC_LG.gif" name="submit" alt="Buy Now">
</form>
Run Code Online (Sandbox Code Playgroud)
提前致谢 !
我需要知道,在android sdk 4.0中
以下行说'找不到文件'.但是webview在sdk 2.2和2.3等中完美加载.
mWebView.loadUrl("file:///android_asset/currentLocation.html?width_="+grosswt+"&height_="+grossht);
Run Code Online (Sandbox Code Playgroud)
在android webview中有没有其他方法可以使用url发送查询字符串?
我在Quora上发表了一篇文章,解释了为什么LinkedIn *1_*1_*1_*1_*1_*在他们的网址中使用令牌.提到的答案有助于跟踪用户来自哪里以使用户能够返回他来自的地方.
URL如何存储这种类型的信息,为什么他们会使用该令牌而不是更传统的东西,例如?last=this-page?
我有一种情况,我需要将一个Map变成一个查询字符串(在第一个之后?).例如,如果我有以下地图:
Map json = {
"email": eml,
"password": passwd
};
Run Code Online (Sandbox Code Playgroud)
一个基本网址:
String baseURL = "http://localhost:8080/myapp";
Run Code Online (Sandbox Code Playgroud)
然后我需要一些东西将json Map转换为基本URL的查询字符串:
String fullURL = parameterizeURL(baseURL, json);
// Prints: http://localhost:8080/myapp?email=blah&password=meh
// (if "blah" was entered as the email, and "meh" was entered as the password)
print(fullURL);
Run Code Online (Sandbox Code Playgroud)
我在Git上找到了这个查询String-to-map库,但我需要反过来!在那里获取URL编码也很棒.
我很高兴自己做一些本土的东西,但对Dart这么新,我想知道是否有任何关于pub/ Github/etherspehere已经做到了这一点.
当标准网址共享时,Google Plus非常擅长提取Open Graph元标记指定的图片,如:
http://stackoverflow.com/questions/22342854/what-is-the-optimal-algorithm-for-the-game-2048
看到:

但是,当您开始附加查询字符串时,事情开始变得棘手,例如在此URL中完成:
http://stackoverflow.com/questions/22342854/what-is-the-optimal-algorithm-for-the-game-2048?utm_source=google-plus&utm_medium=social&utm_campaign=stackoverflow-general-promotion

对于某些URL +查询字符串,默认图像似乎完全没有意义:
http://skeptics.stackexchange.com/questions/4508/can-every-grain-of-sand-be-addressed-in-ipv6?xyz_12312313

上面的screengrab中的图像是最后留下对共享问题的答案的人的用户pic.
是否有任何方法可以强制Google Plus退回由og:image标签定义的图像,即使附加了查询字符串?
query-string open-graph-protocol google-plus facebook-opengraph
真的,几乎就是标题所说的.
假设你有这个字符串:
var theString = "a=b=c=d";
Run Code Online (Sandbox Code Playgroud)
现在,当您运行theString.split("=")结果时,["a", "b", "c", "d"]正如预期的那样.而且,当然,当你运行时,theString.split("=", 2)你会["a", "b"]在阅读MDN页面String#split()后对我有意义.
但是,我正在寻找的行为更像是Java String#split():不是正常构建数组,而是返回前n个元素,它构建了前n-1个匹配的数组,然后将所有剩余的字符添加为最后一个元素数组.有关更好的说明,请参阅相关文档.
如何在Javascript中获得此效果?
我正在寻找具有与Java实现类似的最佳性能的答案,尽管它的实际工作方式可能不同.
我发布了我的尝试,但我根本不知道怎么写这个.
query-string ×10
url ×4
javascript ×2
android ×1
asp.net ×1
asp.net-mvc ×1
dart ×1
eclipse-pdt ×1
facebook ×1
google-plus ×1
map ×1
mobile ×1
parameters ×1
paypal ×1
split ×1
webview ×1