怎样用php显示这张图片

四季变幻 2015-08-31 03:49:34
http://7xigfd.com1.z0.glb.clouddn.com/wp-content/uploads/2015/08/134.jpg


function image($url, $referer_url) {
//$url = $this->input->get('url');
$dir = pathinfo($url);
$host = $dir['dirname'];
$refer = $host . '/';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_REFERER, $refer);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, $referer_url);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"); //模拟用户使用的浏览器
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); //在发起连接前等待的时间,如果设置为0,则无限等待
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //设置超时限制防止死循环
$data = curl_exec($ch);
curl_close($ch);

$ext = strtolower(substr(strrchr($url, '.'), 1, 10));
$types = array(
'gif' => 'image/gif',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'png' => 'image/png',
);
$type = $types[$ext] ? $types[$ext] : 'image/jpeg';
header("Content-type: " . $type);
echo $data;
}这种方法不行 有没有可用的方法?
...全文
180 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
诸葛亮亮亮 2015-09-01
  • 打赏
  • 举报
回复
echo "<img src='http://7xigfd.com1.z0.glb.clouddn.com/wp-content/uploads/2015/08/134.jpg'/>"; 这样不行吗?
四季变幻 2015-09-01
  • 打赏
  • 举报
回复
引用 8 楼 xuzuning 的回复:
我%……&*))(* 我试过用http://7xigfd.com1.z0.glb.clouddn.com作来源就是没用knewsmart.com 快被自己蠢哭了 非常感谢!
xuzuning 2015-09-01
  • 打赏
  • 举报
回复
四季变幻 2015-09-01
  • 打赏
  • 举报
回复
引用 6 楼 fdipzone 的回复:
图片不存在或没有权限访问。
有办法hack吗?
傲雪星枫 2015-09-01
  • 打赏
  • 举报
回复
图片不存在或没有权限访问。
四季变幻 2015-09-01
  • 打赏
  • 举报
回复
引用 3 楼 xuzuning 的回复:
总不能无中生有吧?
http://knewsmart.com/applefan/9423/ 原图在这里,打开这个然后上面那张图就可以打开了
四季变幻 2015-09-01
  • 打赏
  • 举报
回复
引用 3 楼 xuzuning 的回复:
总不能无中生有吧?
http://7xigfd.com1.z0.glb.clouddn.com/wp-content/uploads/2015/08/135.jpg 这张图打不开吧
xuzuning 2015-09-01
  • 打赏
  • 举报
回复
总不能无中生有吧?
四季变幻 2015-09-01
  • 打赏
  • 举报
回复
引用 1 楼 u012997778 的回复:
echo "<img src='http://7xigfd.com1.z0.glb.clouddn.com/wp-content/uploads/2015/08/134.jpg'/>"; 这样不行吗?
你试了可以吗?

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧