php 接收到其他文件的重定向输出

WBOY
Release: 2016-06-20 13:02:06
Original
1343 people have browsed it

php 接收到其他文件的重定向输出

if(is_file($filename)){
    $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
        if (in_array($extension, array('png', 'gif', 'jpeg' , 'jpg'))) {
            header("Content-Type: image/".$extension);
        } else {
            if($extension == 'css')
                header("Content-Type: text/css");
            if($extension == 'js')
                header("Content-Type: application/x-javascript");
        }
        header("Cache-Control: private, max-age=".$browser_cache);
        header('Expires: '.gmdate('D, d M Y H:i:s', time()+$browser_cache).' GMT');
        header('Content-Length: '.filesize($filename));
        $length = filesize($filename);
        $result = readfile($filename);
        readfile($filename);
        exit();
}
Copy after login

 


Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template