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

编程入门 行业动态 更新时间:2024-10-16 23:22:14
Query字符串中参数的位置如何影响页面?(How does position of parameters in a Query string affect the page?)

我有一个用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?

Thanks.

最满意答案

正确编写的应用程序将以任何顺序查找给定的查询参数,并且不会对顺序敏感。 虽然编写得很差的解析代码是可能的,但只能在开始,结束时或仅在其他参数后面找到给定参数。 在没有看到解析查询参数的代码的情况下,我们不能真正说出它有什么问题,但是可能会写入对位置不敏感的代码。

如果您发布解析查询参数的代码以及可以工作的查询字符串,而不是那种查询字符串,我们可以更具体地提出建议。 您还应该检查以确保您的查询参数没有任何应该被编码的字符,这些字符可能会丢掉任何东西。

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.

更多推荐

本文发布于:2023-07-17 13:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1144917.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   位置   参数   页面   Query

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!