Home >Backend Development >PHP Tutorial >A small example of php http protocol application

A small example of php http protocol application

WBOY
WBOYOriginal
2016-07-25 09:00:57975browse
In the process of learning PHP programming, it is recommended that you understand the relevant knowledge of the HTTP protocol. Here are two small examples for your reference.

The following are two examples of the php http protocol. Friends in need can refer to them. 1. Control the browser to jump at a certain time through http response.

<?php
//通过http响应,控制浏览器在一定时间跳转
//3秒 浏览器跳转到指定url
//header("Refresh: 3; url=http://bbs.it-home.org");
header("Refresh: 3; url=http://localhost/htdocs/test.php");
?>

2. Set to disable caching, which can be viewed through the httpwatch packet capture tool.

<?php
    //禁用缓存
    header("Expires: -1");
    header("Cache-Control: no-cache");
    header("pragam: no-cache");
    echo "禁用缓存"; //by bbs.it-home.org
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn