课程: PHP with MySQL Essential Training: 1 The Basics
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Page redirection
- [Instructor] In this movie, we're going to build on what we just learned about modifying header information, to learn how to perform page redirection. In HTTP, a web server can tell a web browser that ought to go to a new URL by something known as a 302 redirect. A 302 redirect has two parts to it. Both of which are items that are in the header information that's sent back to the browser. The first is a status code of 302 found. And the second is a location attribute indicating the new URL that the browser ought to try instead. PHP is smart enough to know that if we're setting the location, then we also want to set the status code to 302 at the same time. We don't have to manually set it just by saying header and then telling it the new location, it knows this must be a redirect because that's the only thing the location attribute is used for. A 302 status code in the header indicates to the browser that it should immediately make a new request to this new location. It ignores any…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。