课程: PHP with MySQL Essential Training: 1 The Basics

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Encode URL parameters

Encode URL parameters

- [Instructor] Over the last few movies, we learned to send a value as a URL parameter. So far, we use it to send sample data like an ID or a page number. In this movie, I want us to discuss how to handle data, which could include certain special characters that require extra attention. And the reason why is because they might have special meaning to the URL. Let me give you an example. Let's imagine that we have a link that we want to use that passes along a query parameter that is the name of a company. So company, equals, and then the name of the company. And one of our links happens to use the company name, Widgets&More. And the name of the company is Widgets&More. Notice the ampersand right in the middle of the name though. If you remember that ampersand has special meaning to the URL. When we want to join together more than one URL parameter, we use ampersand to join them together. So what we want is for the ampersand to be seen as being data, as simply being part of the string…

内容