Home  >  Article  >  Backend Development  >  How to hide image address in php

How to hide image address in php

coldplay.xixi
coldplay.xixiOriginal
2020-10-05 14:09:402220browse

How to hide the image address in php: modify upload to the directory of the image to be hidden, the code is [if(file_exists("upload/".$_SERVER['PATH_INFO']))].

How to hide image address in php

How to hide the image address in php:

is simpler than those on the Internet (the ones on the Internet basically cannot be used) ) Modify upload as the directory of the pictures you want to hide, static/404.png as your 404 picture directory

The effect is xxx.php/xx.xx (as long as it is the picture type! The type can be automatically determined !)

 <?php
 header("Content-type: image/".(@end(explode(".","upload/".$_SERVER[&#39;PATH_INFO&#39;]))));
 if(file_exists("upload/".$_SERVER[&#39;PATH_INFO&#39;]))
   echo file_get_contents("upload/".$_SERVER[&#39;PATH_INFO&#39;]);
    else
    echo file_get_contents("static/404.png");
 ?>

If you want to learn more about programming, please pay attention to the php training column!

The above is the detailed content of How to hide image address in php. For more information, please follow other related articles on the PHP Chinese website!

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