Professional Information Technology-Programming Book part 79

Tham khảo tài liệu 'professional information technology-programming book part 79', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | HTTP Headers Every page downloaded from a web server is a result of an exchange of HTTP dialogue. The web browser sends a set of instructions to indicate which page it wants to view and the server responds with a response that indicates the success of the request along with various other information that is not displayed directly on the web page. The following HTTP headers show some of the information that is sent along with a typical web page from a PHP-enabled web server HTTP 200 OK Date Tue 14 Dec 2004 21 17 28 GMT Server Apache Unix mod_gzip PHP mod_ssl OpenSSL X-Powered-By PHP Connection close Content-Type text html charset iso-8859-1 Sending Custom Headers The PHP function to send a custom HTTP header is header. Let s start by sending a header that does nothing. Any header that begins with X is considered to be for information only for example the X-Powered-By header shows that PHP is enabled. To stamp your name in the HTTP headers in your script you could use the following header X-PHP-Author Chris Newman chris@ Of course there is no reason you should want to send a header like this other than extreme vanity. A regular user browsing the website would never even see this header You have already seen how cookies are sent to a web browser by using the setcookie function. You have also seen that what happens when this function is called is that a Set-Cookie HTTP header is actually sent. The following two PHP statements are therefore equivalent setcookie mycookie somevalue header Set-Cookie mycookie somevalue Redirection Headers The header you will send most often is almost certain to be Location which instructs the web browser to redirect to another URL. You can use this header to change the flow of a website according to events in script. Causing the user s browser to forward to another page is as simple as this header Location You can use either a relative or absolute URL in the .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
211    106    6    02-07-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.