新建一个images.php文件
代码如下
<?php
//header('Content-Type:image/gif');
readfile(base64_decode(trim($_GET['imgid'])));
?> 调用代码是:
<img width=310 src="images.php?imgid=<?php echo base64_encode($pic_url) ?>" height=310>
$pic_url为远程动态的图片地址比如我想调用http://images.chinaz.com/tool/bainian.gif图片地址
通过加密侯得到的地址是:images.php?imgid=aHR0cDovL2ltYWdlcy5jaGluYXouY29tL3Rvb2wvYmFpbmlhbi5naWY=
这样可以正常显示,但是刷新一次后用调用不出来了
提示Warning: readfile(http://images.chinaz.com/tool/bainian.gif) [function.readfile]: failed to open stream: HTTP request failed! in d:\xxxxx\xxxxx\wwwroot\images.php on line 3
时隔几秒后又正常了请问怎么解决呢?请问还有其他的图片地址加密方法吗?php的
代码如下
<?php
//header('Content-Type:image/gif');
readfile(base64_decode(trim($_GET['imgid'])));
?> 调用代码是:
<img width=310 src="images.php?imgid=<?php echo base64_encode($pic_url) ?>" height=310>
$pic_url为远程动态的图片地址比如我想调用http://images.chinaz.com/tool/bainian.gif图片地址
通过加密侯得到的地址是:images.php?imgid=aHR0cDovL2ltYWdlcy5jaGluYXouY29tL3Rvb2wvYmFpbmlhbi5naWY=
这样可以正常显示,但是刷新一次后用调用不出来了
提示Warning: readfile(http://images.chinaz.com/tool/bainian.gif) [function.readfile]: failed to open stream: HTTP request failed! in d:\xxxxx\xxxxx\wwwroot\images.php on line 3
时隔几秒后又正常了请问怎么解决呢?请问还有其他的图片地址加密方法吗?php的
还是要加的
2 另外你的这个只是base64编码,不是加密。
这是我ad.php中的内容,没问题:<?php
header('Content-Type:image/jpeg');
if(isset($_GET['imgid']))readfile(base64_decode(trim($_GET['imgid'])));
?> <img width=310 src="ad.php?imgid=<?php echo base64_encode('aaa.jpg') ?>" height=310>
出错代码
Warning: readfile(http://img03.taobaocdn.com/bao/uploaded/i3/T1V3VyXfBsXXXKwXU._080900.jpg) [function.readfile]: failed to open stream: HTTP request failed! in d:\xxxx\xxx\wwwroot\ad.php on line 5
不显示,显示X
通过图片地址访问出现下面的错误:
Warning: readfile(http://img03.taobaocdn.com/bao/uploaded/i3/T1V3VyXfBsXXXKwXU._080900.jpg) [function.readfile]: failed to open stream: HTTP request failed! in d:\xxxx\xxx\wwwroot\ad.php on line 5