我有网址:http : //site.com/page.aspx?update
如何检查该更新值是否存在?
HttpValueCollection将其视为具有null键的实体。我试过了:
var noKeyValues = Request.QueryString.GetValues(null);
if (noKeyValues != null && noKeyValues.Any(v=>v==update)) ...
Run Code Online (Sandbox Code Playgroud)
但它让我皱眉,因为 GetValues 的参数是用 [NotNull] 修饰的。
所以我最终做了:
var queryValuesWithNoKey =
Request.QueryString.AllKeys.Select((key, index) => new { key, value = Request.QueryString.GetValues(index) }).Where(
item => item.key == null).Select(item => item.value).SingleOrDefault();
if (queryValuesWithNoKey != null && queryValuesWithNoKey.Any(v => v.ToLower() == "update")) live = true;
Run Code Online (Sandbox Code Playgroud)
不是最优雅的解决方法。有没有更好的方法从查询字符串中获取无键值?
我想执行一个回发并在我的查询字符串中添加了几个值.我一直在使用重定向到相同的URL,只是添加查询字符串参数,但是当我这样做我的视图状态被清除,这是我需要避免.
由于我正在使用的技术(SharePoint),我必须使用查询字符串传递我的参数.
我做了一些环顾四周,但没有找到关于如何使用不同的查询字符串参数完成回发的明确答案.有没有办法做到这一点?
我想从asp.net上的url获取数据.我需要数据是一个字符串,然后我可以在其他代码中使用它.
http://example.com/service_name/videos/?category={0}&offset={1}&maxResult={2}
Run Code Online (Sandbox Code Playgroud)
我需要类别偏移和maxresult的数字.
谁能帮我?
我有一个 Web 应用程序,它位于另一个 Web 应用程序的 iframe 中(两者都是在 ASP.NET MVC 中完成的)。
是否可以使用 C# 从 iframe 内的应用程序读取父 Web 应用程序的查询字符串参数?
我每页只显示3个产品.所以在我的catalog.xml中我有
<action method="setDefaultGridPerPage"><limit>3</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action>
Run Code Online (Sandbox Code Playgroud)
如果我去/category.html,我只会看到3个产品.它很棒!
但我也希望能够一次显示所有产品,因此我将以下内容添加到catalog.xml中:
<action method="addPagerLimit"><mode>grid</mode><limit>999</limit></action>
Run Code Online (Sandbox Code Playgroud)
现在,如果我导航到/category.html?limit=999,我可以按预期看到所有类别的产品.
当我回到/category.html,没有限制参数时,它显示所有产品而不是我希望它做的3.它发生是因为Magento缓存了限制偏好.
是否存在阻止magento缓存列表选项的配置?
先感谢您.
我需要编辑node.js应用程序获取查询字符串,不使用(i)使用Express或任何其他模块,以及(ii)创建除已存在的服务器之外的服务器.
我想将?id = helloworld传递给变量id.
我该怎么做?
我正在尝试将查询字符串中的值添加到响应重定向中。我在下面添加了我的代码,任何帮助都会很棒。
If Boolean.Parse(ConfigurationManager.AppSettings.Item("Development")) Then
If Request.QueryString("ABC") = "Y" Then
Session("Website") = "abc"
End If
If Not Request.QueryString("LOCATION") = "" Then
Response.Redirect "mysite.co.uk/location/" & Request.QueryString("LOCATION")
End If
End If
Run Code Online (Sandbox Code Playgroud) 我有一个 URL,它成为具有该http_build_query函数的查询字符串。
但是我有一个timestamp无法编辑的参数。并×成为乘号x。
有解决方法吗?
这是我传递给http_build_query函数的数组。
$parameters = array(
"transaction_id"=>uniqid("FF-"),
"timestamp"=> time(),
"order_total"=>$_SESSION['total_price'],
"order_total_with_vat"=>$_SESSION['total_price'] * 1.21,
"order_vat"=>"21",
"payment_method"=>"ideal",
"payment_status"=>"1",
"customer_name"=>$_SESSION['customer_data']['naam'],
"customer_address"=>$_SESSION['customer_data']['address'],
"customer_city"=>$_SESSION['customer_data']['city'],
"customer_zipcode"=>$_SESSION['customer_data']['zipcode'],
"customer_country"=>$_SESSION['customer_data']['country'],
"customer_email"=>$_SESSION['customer_data']['email'],
"customer_telephone"=>$_SESSION['customer_data']['telephone'],
);
Run Code Online (Sandbox Code Playgroud)
网址输出:
http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9×tamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5
Run Code Online (Sandbox Code Playgroud)
首选输出:
http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9×tamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5
Run Code Online (Sandbox Code Playgroud)
http_build_query 功能:
case 'POST':
curl_setopt( $curlHandler, CURLOPT_POST, true );
$url .= '?' . http_build_query( $parameters );
break;
Run Code Online (Sandbox Code Playgroud) $location我想像这个例子一样提取我的网址查询字符串。我的网址 -http://someDomain.com/create/index.jsp?queryToken=123abc
在我的指令中:
vm.queryParam = $location.search();
$log.log('vm.queryParam', vm.queryParam); //{}
vm.details.query = vm.queryParam.queryToken;
$log.log('vm.queryToken', vm.details.query); //undefined
Run Code Online (Sandbox Code Playgroud)
我可以在记录时看到一个或多个参数,但是在不起作用$location时提取它们的正确方法是什么?search()
谢谢。
我无法使用qsnpm 包解析第一个查询字符串参数。我究竟做错了什么?
我在控制台中执行这些命令
import * as qs from './qs'
var addr = "https://www.somesite.se/?title=querystring&action=edit"
var parsed = qs.parse(addr)
Run Code Online (Sandbox Code Playgroud)
执行这些命令后parsed具有以下值:
{ 'https://www.somesite.se/?title': 'querystring',
action: 'edit' }
Run Code Online (Sandbox Code Playgroud)
这很奇怪。为什么title不是返回对象的属性?我期望的值parsed.title是'querystring'。但事实并非如此。值parsed.titleIS undefined。
为什么?
query-string ×10
asp.net ×3
javascript ×3
asp.net-mvc ×2
.net ×1
angularjs ×1
c# ×1
iframe ×1
magento ×1
node.js ×1
php ×1
postback ×1
vb.net ×1