我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

PHP显示为图像

I am trying to make a PHP page load an image and display, as if it were an image file. Here's what I tried to do:

header("Content-type: image/png"); 
echo base64_encode(file_get_contents($ad->location));

But this doesn't seems to work. How should this be done?

Thank you.

You don't need to base64 encode image data when outputting it as a file. Just pass it through.

近期文章

  • 缓存XML响应
  • 我想构建正则表达式从php中的字符串中提取子字符串
  • 如何通过php文件自动加载网站?
  • 如何将500k图像从单个目录分隔到多个?
  • 想剥去一个特定的角色
  • 如何获取我系统的IP地址
  • 图像文件的绝对路径不起作用
  • 如何在PHP中从此字符串中提取两个变量
  • 由于无法实例化XXX类,推进发电机失效
  • PHP - RegEx问题
  • 如何在电子邮件中制作html表单并访问数据
  • 如何在固定的时间范围内暂停此循环?
  • strip()并获得价值
  • MYSQL数据库存在问题
  • 如何获取返回页面的网址?
  • PHP和MySQL预览按钮问题
  • 连接到MySql DB(PHP)时出现问题
  • 用于旧应用程序的PHP框架
  • 正则表达式和换行符
  • php中的数字表示问题

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华