What is the "?" symbol in URL used for in php?

I am new to PHP. In the path of learning PHP language, I notice that, some website would this kind of URL:


My questions:

  1. What is the "?" symbol used for?

  2. If I were develop a php website, must I use it in my URL? For example, after a user(roa3) successful logged in, I will redirect to "www.website.com/profile.php?user=roa3" instead of "www.website.com/profile.php"

  3. What are the advantages and disadvantages of using it?

Good questions, briefly,

  1. "?" stands for the start of querying string which contains the data to be passed to the server. in this case you are passing user=roa3 to profile.php page. You can get the data by using $_GET['user'] within profile.php. querystring is one of the methods to send data to the server from client agent. The other one places the data in HTTP body and POST to the server, you don't see the HTTP POST data directly from browser.

  2. querystring can be edited by user and it is visible to the public. If www.website.com/profile.php?user=roa3 is intended to be public then it is fine, otherwise you may want to use session to get current user's context.

  3. it is a flexible way to pass data to the server, but it is visible and editable to the users, for some sensitive data, at least produce some kind of hash before attaching it to the querystring, this prevents users to edit it or understanding the meaning of it. However this doesn't prevent a decent hacker to do something wrong about your website. Different browsers support different max length of URL, the lengthy URL is made up by those querystring parameters. If you want to send large amount of data, place the data in the HTTP body and POST to the server.

What is a pronoun? (video), There are two main ways to pronounce this little word, based largely on what word follows it. If the is followed by a word which begins with a consonant sound ( � The (/ ð ə, ð iː / ()) is a grammatical article in English, denoting persons or things already mentioned, under discussion, implied or otherwise presumed familiar to listeners, readers or speakers.

The, The shirt was pretty expensive, but the shoes weren't. used before noun phrases in which the range of meaning of the noun is limited in some� Is definition is - present tense third-person singular of be; dialectal present tense first-person and third-person singular of be; dialectal present tense plural of be How to use is in a sentence.

1) If a user logs in to your site, you would use Sessions to store there username instead of passing it in the url e.g profile.php?username=roa3

2) Using a ? symbol in the urls is generally considered bad for Search Engine Optimization. Also, the urls look a bit ugly. Using mod_rewrite you can do the same thing as profile.php?user=roa3 or products.php?id=123&category=toys with: site.com/profile/roa3 or products/toys/123.

Using the CodeIgniter framework will give you friendly URLs by default and eliminate the need for ?s in your urls. See this page for an example.

3) The ? symbol is also used inside the code of a php page. For example, an if else block such as:

if ($x==1)

can also be written as:

$y=($x==1) ? 2 : 3;

The, Verbs can be used to describe an action, that's doing something. For example, like the word 'jumping' in this sentence: The rabbit was jumping in the field. What Is the What: The Autobiography of Valentino Achak Deng is a 2006 novel written by Dave Eggers.It is based on the life of Valentino Achak Deng, a Sudanese child refugee who immigrated to the United States under the Lost Boys of Sudan program.

THE, A verb is the word or words in a sentence that show action, or tell you what the subject of the sentence is doing. There are different kinds of verbs, including� And definition is - —used as a function word to indicate connection or addition especially of items within the same class or type—used to join sentence elements of the same grammatical rank or function.

? is part of the HTTP standard and not part of PHP. Thought I should point that out so when you move on to another language and see it again you are not confused thinking there is PHP involved.

Otherwise there are some excellent answers above.

What is a verb?, The virus in question was a coronavirus that caused an epidemic of severe acute Duration: 5:16 Posted: 14 May 2020 If definition is - in the event that. How to use if in a sentence.

What is a coronavirus? - Elizabeth Cox, What is Blockchain? If this technology is so complex, why call it “blockchain?” At its most basic level, blockchain is literally just a chain of� Question: "What is the gospel?" Answer: The word gospel literally means “good news” and occurs 93 times in the Bible, exclusively in the New Testament. In Greek, it is the word euaggelion, from which we get our English words evangelist, evangel, and evangelical.

Blockchain: Everything You Need to Know, SIR – Your report (August 7) that 235 migrants crossed the English Channel on Thursday to enter Britain without permission puts a question� The domain name com is a top-level domain (TLD) in the Domain Name System of the Internet.Added in 1985, its name is derived from the word commercial, indicating its original intended purpose for domains registered by commercial organizations.

Letters: What is the point of Border Force if it cannot turn back , The .com at the end of many web addresses (such as Lifewire.com) is called a top-level domain (TLD). The .com ending is the most common generic top-level domain. The .com TLD represents a commercial domain, which conveys the type of content that's published.

  • Checking session ids against IPs is not that great if people sit behind some proxy farm with multiple IP addresses. Also, those sharing one proxy would still not be shielded from another. The application has to handle this in another way - if you deal with sensitive data: Use https.
  • yes that is true. Checking ip's against sessions would give increased security, but it would leave some big holes. Establishing teh session after https has been established is always the safest.
  • Just a sidenote: It is legal to use ; to separate GET vars too. Though I've never seen it and therefore wouldn't recommend it.
  • This is wrong. The "?" is not "just another character" to the server. The server splits the URL on the "?" (if there is one). The part before is the requested file, and the part after is the "query string", presented to the CGI as the QUERY_STRING environment variable.
  • I should probably have said that servers in general are not expected to treat it specially. In the case of PHP (and most other web frameworks) some treatment is provided, as I went on to discuss. The question doesn't specify CGI anywhere.
  • It may not be special to the server, but it is part of the HTTP standard rather than php.
  • Stubbornly sticking to my guns here :-) There's only one effective distinction of ? in RFC21616, S13.9: "caches must not treat responses to [query URIs] as fresh unless the server provides an explicit expiration time." That hardly seems relevant.
  • Okay, four downvotes for a fundamentally correct answer (with one small caveat) is certainly excessive and marking it offensive is purely … well, offensive!