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!