What does dollar sign $ do in url?

前端 未结 2 1007
难免孤独
难免孤独 2021-02-01 03:56

I have been reading that $ ! ; . , are \'reserved\' chars in url. But I can not find what are they reserved for.

/ path delimiter  
: port
? query         


        
相关标签:
2条回答
  • 2021-02-01 04:15

    Your question is a bit broad, but the RFC 2396 should contain all your answers.

    Many URI include components consisting of or delimited by, certain special characters. These characters are called "reserved", since their usage within the URI component is limited to their reserved purpose. If the data for a URI component would conflict with the reserved purpose, then the conflicting data must be escaped before forming the URI.

     reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
                    "$" | ","
    

    The "reserved" syntax class above refers to those characters that are allowed within a URI, but which may not be allowed within a particular component of the generic URI syntax; they are used as delimiters of the components described in Section 3.

    Characters in the "reserved" set are not reserved in all contexts. The set of characters actually reserved within any given URI component is defined by that component. In general, a character is reserved if the semantics of the URI changes if the character is replaced with its escaped US-ASCII encoding.

    0 讨论(0)
  • 2021-02-01 04:24

    RFC 2396 is obsolete.

    For modern versions of the spec, see:

    • RFC3987 (in relation to IRI's); and
    • RFC3986 (in relation to URI's).

    About /

    Yes, that is used as a delimiter in the path part.

    About :

    Ye, it is used as a prefix for port, but it has other roles such as the user info separator, and a delimiter for IP styles of host specifiers.

    About =

    Suprisingly, the = character is not part of the general URL, URI nor IRI syntax. It has a special meaning only the the http(s) protocols. This is not intrinsic to URL/IRI/URI

    About +

    The role of + as a substitute for space is NOT part of the URL/URI/IRI syntax. It is merely a convenient invention of some PHP programs for pretty URL purposes.

    About $ and ;

    These have no special meaning in the URL/URI/IRI syntax. They can be part of the sub-delimiters production, which can be used in the user info part, future-IP part, path segment or a host part.

    0 讨论(0)
提交回复
热议问题