"; then create the test3.php file; finally pass " @copy" just hide the picture."/> "; then create the test3.php file; finally pass " @copy" just hide the picture.">

Home  >  Article  >  Backend Development  >  How to hide pictures in php

How to hide pictures in php

藏色散人
藏色散人Original
2020-11-26 09:13:461528browse

How to hide pictures in php

Recommended: "PHP Video Tutorial"

The operating environment of this tutorial: Windows 7 system, PHP version 5.6, this method is suitable for all brands computer.

php Hide image address

Code:

test.php

<img src="test3.php?path=file/118812060.jpg"> 
<br>this is test!

test3.php

<?php
$path=$_GET["path"];
$cacheimgname=str_replace("/","_",$path);
$localimg="testimg/".$cacheimgname;
 
if ((file_exists($localimg)))
{
$httpurl=$localimg;
}
else
{
$httpurl="http://www.domain.com/".$path;
@copy($httpurl,$localimg);//缓存图片!
}
 
header("Location:$httpurl");
exit;
?>

The actual address is: testimg/file_118812060.jpg

For more programming-related knowledge, please visit: Programming Learning! !

The above is the detailed content of How to hide pictures 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