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
  • 相关阅读:
    统计字符
    两军交锋
    FatMouse' Trade
    A + B Problem II
    Number Sequence
    Max Sum
    类的设计
    类与对象
    面向对象思想
    第一个OC程序
  • 原文地址:https://www.cnblogs.com/limeng951/p/5634103.html
Copyright © 2011-2022 走看看