查询字符串中参数的位置如何影响页面? [英] How does position of parameters in a Query string affect the page?

查看:43
本文介绍了查询字符串中参数的位置如何影响页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,其中大多数代码都是用javascript编写的.我遇到一个奇怪的问题.我有一个查询字符串,我的应用程序读取它来执行各种操作.昨天,我更改了查询字符串参数的顺序,并且该应用程序停止了工作.如果我把原始订单放回去,那么它将开始工作.可能是什么原因?我认为参数排序的影响应该无关紧要.但是,显然这确实有某种原因.我仍在尝试找出问题所在,但想知道这里是否有人遇到类似的问题?

I have an application with most of the code written in javascript. I am encountering a strange problem. I have a query string and my app reads it to perform various actions. Yesterday I changed the ordering of the query string parameters and the application stopped working. If I put the original order back then it starts working. What could be the reason? I thought that the effect of ordering of parameters should not matter. But, apparently it does matter for some reason. I am still trying to dig out what can be the issue but wanted to know if any one here has encountered a similar problem?

谢谢.

推荐答案

正确编写的应用程序将以任何顺序找到给定的查询参数,并且对顺序不敏感.尽管可能编写的解析代码编写得很差,但它们只会在开头,结尾或仅在某些其他参数之后才能找到给定的参数.在没有看到解析查询参数的代码的情况下,我们无法真正说出它有什么问题,但是有可能编写的位置敏感的代码写得不好.

A properly written application will find a given query parameter in any order and will not be order sensitive. It is possible though to have poorly written parsing code that would only find a given parameter at the beginning, at the end, or only if after some other parameter. Without seeing the code that parses the query parameters, we can't really say what problem it has, but it is possible to have poorly written code that is position-sensitive.

如果您发布用于解析查询参数和有效的查询字符串以及无效的查询字符串的代码,我们可以为您提供更具体的建议.您还应该检查以确保查询参数中没有任何应该被编码的可能会丢掉东西的字符.

If you post the code that parses the query parameters and the query string that works and the one that doesn't, we could advise more specifically. You should also check to make sure that your query parameters don't have any characters in them that are supposed to be encoded that could be throwing things off.

这篇关于查询字符串中参数的位置如何影响页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆