zoukankan      html  css  js  c++  java
  • PHP中header的作用

    1、跳转

    //若等待时间为0,则与header("location:")等效。 
    //Header("Location:http://localhost//session.php");直接跳转

    2、指定网页的内容

    3、附件


       下载:

        $filename = "tupian.jpg"; //文件路径  可以绝对路径也可以相对路径
       header('Content-type: application/x-jpg'); //文件的类型 http://www.w3school.com.cn/media/media_mimeref.asp
    header('Content-Disposition: attachment; filename="保存时的文件名.jpg"'); //下载显示的名字 
    readfile("$filename"); 
    exit(); 

    pg"; //文件路径//

    octet-stream'); //文件的类型 octet-stream readfile("$filename"); 
    exit(); 

         查看:

    $link = "tupian.jpg"; //文件路径  可以绝对路径也可以相对路径

    //$link = "新建文本文档.xml"; //文件路径  可以绝对路径也可以相对路径
    if (isset($link)) 
                    { 
                        Header("HTTP/1.1 303 See Other"); 
                        Header("Location: $link"); 
                        exit; 
                    } 

     
    0
    0
  • 相关阅读:
    3.24课堂
    3.23作业
    3.23课堂
    3.20作业
    3.20课堂
    3.19作业
    3.19课堂
    3.18课堂
    3.18作业
    46、表与表的连接
  • 原文地址:https://www.cnblogs.com/limeng951/p/5634103.html
Copyright © 2011-2022 走看看