query-string

Laravel Queries Strings

99封情书 提交于 2019-12-17 11:42:24
问题 Does anyone know if it's possible to make use of URL query's within Laravel. Example I have the following route: Route::get('/text', 'TextController@index'); And the text on that page is based on the following url query: http://example.com/text?color={COLOR} How would I approach this within Laravel? 回答1: Yes, it is possible. Try this: Route::get('test', function(){ return "<h1>" . Input::get("color") . "</h1>"; }); and call it by going to http://example.com/test?color=red . You can, of course

How to update querystring in C#?

梦想与她 提交于 2019-12-17 10:23:16
问题 Somewhere in the url there is a &sortBy=6 . How do I update this to &sortBy=4 or &sortBy=2 on a button click? Do I need to write custom string functions to create the correct redirect url? If I just need to append a query string variable I would do string completeUrl = HttpContext.Current.Request.Url.AbsoluteUri + "&" + ... Response.Redirect(completeUrl); But what I want to do is modify an existing querystring variable. 回答1: To modify an existing QueryString value use this approach: var

Modifying a query string without reloading the page

时光怂恿深爱的人放手 提交于 2019-12-17 08:12:04
问题 I am creating a photo gallery, and would like to be able to change the query string and title when the photos are browsed. The behavior I am looking for is often seen with some implementations of continuous/infinite page, where while you scroll down the query string keeps incrementing the page number (http://x.com?page=4) etc.. This should be simple in theory, but I would like something that is safe across major browsers. I found this great post, and was trying to follow the example with

How can I mod_rewrite and keep query strings?

北慕城南 提交于 2019-12-17 07:51:33
问题 I want to mod_rewrite a URL to another page, but then I also want any query strings added to be preserved. RewriteEngine On #enforce trailing slashes RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !# RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://localhost/siteroot/$1/ [L,R=301] RewriteRule ^apps/([A-Za-z0-9-_]+)/?$ index.php&app=$1 So if a user visits apps/app1/ , index.php?app=app1 is shown. However, I want to be able to preserve optional query strings, so that

Semicolon as URL query separator

倾然丶 夕夏残阳落幕 提交于 2019-12-17 07:21:09
问题 Although it is strongly recommended (W3C source, via Wikipedia) for web servers to support semicolon as a separator of URL query items (in addition to ampersand), it does not seem to be generally followed. For example, compare http://www.google.com/search?q=nemo&oe=utf-8 http://www.google.com/search?q=nemo;oe=utf-8 results. (In the latter case, semicolon is, or was at the time of writing this text , treated as ordinary string character, as if the url was: http://www.google.com/search?q=nemo

What is the limit on QueryString / GET / URL parameters

断了今生、忘了曾经 提交于 2019-12-17 04:01:39
问题 What is the limit on QueryString / GET / URL parameters 回答1: There is no limit in theory. For HTTP URLs, the HTTP 1.1 specification states: The HTTP protocol does not place any a priori limit on the length of a URI. Servers MUST be able to handle the URI of any resource they serve, and SHOULD be able to handle URIs of unbounded length if they provide GET-based forms that could generate such URIs. A server SHOULD return 414 (Request-URI Too Long) status if a URI is longer than the server can

How do I parse a URL query parameters, in Javascript? [duplicate]

坚强是说给别人听的谎言 提交于 2019-12-17 02:28:45
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Use the get paramater of the url in javascript How can I get query string values in JavaScript? In Javascript, how can I get the parameters of a URL string (not the current URL)? like: www.domain.com/?v=123&p=hello Can I get "v" and "p" in a JSON object? 回答1: Today (2.5 years after this answer) you can safely use Array.forEach . As @ricosrealm suggests, decodeURIComponent was used in this function. function

How to parse a query string into a NameValueCollection in .NET

半城伤御伤魂 提交于 2019-12-16 22:21:29
问题 I would like to parse a string such as p1=6&p2=7&p3=8 into a NameValueCollection . What is the most elegant way of doing this when you don't have access to the Page.Request object? 回答1: There's a built-in .NET utility for this: HttpUtility.ParseQueryString // C# NameValueCollection qscoll = HttpUtility.ParseQueryString(querystring); ' VB.NET Dim qscoll As NameValueCollection = HttpUtility.ParseQueryString(querystring) You may need to replace querystring with new Uri(fullUrl).Query . 回答2:

Change URL parameters

拜拜、爱过 提交于 2019-12-16 19:57:03
问题 I have this URL: site.fwx?position=1&archiveid=5000&columns=5&rows=20&sorting=ModifiedTimeAsc what I need is to be able to change the 'rows' url param value to something i specify, lets say 10. And if the 'rows' doesn't exist, I need to add it to the end of the url and add the value i've already specified (10). 回答1: I've extended Sujoy's code to make up a function. /** * http://stackoverflow.com/a/10997390/11236 */ function updateURLParameter(url, param, paramVal){ var newAdditionalURL = "";

Convert query string dictionary (or associative array) to dictionary [duplicate]

守給你的承諾、 提交于 2019-12-14 04:19:47
问题 This question already has answers here : How to parse a query string into a NameValueCollection in .NET (18 answers) Closed 2 years ago . I'm trying to accept a query string of the form ?param[key1]=value1&param[key2]=value2 and convert it into a Dictionary in C# MVC 4. This is trivial to do in PHP, but I haven't been able to find any method of reproducing this in C#. I know I can take an array via ?param=value1&param=value2 but that leaves issues of ordering and isn't nearly as useful for my