dongyuan2388 2014-07-20 06:00
浏览 5
已采纳

php代码从/ images中检索图像

As you can see, I'm a beginner. I now have my search page retrieving the information from MYSQL but I have the images stored in public_html/images and have the code images/something.jpg stored in MYSQL. I've tried what I could find on the web but the best I've managed is to get a broken image. I've decided to give up after about three hours of searching and admit I need help. This is the last thing I tried. I know it's wrong because it doesn't work.

$img_url = "http://www.mysite.net/public_html/images/"; 
    { 
    echo '<img src="'.$img_url.$result['Images'].'" />'; 
    } 

It seemed to make some sort of sense to me so I'd appreciate an explanation of why it is wrong. Thanks

  • 写回答

1条回答 默认 最新

  • donglian4464 2014-07-20 06:10
    关注

    The public_html folder is the entry point to your web server on Apache servers and maps to a domain's root, i.e. some folder that is internally /public_html/index.php will be http://example.org/index.php externally.

    Therefore, I believe your problem can be solved by removing public_html in your path:

    $img_url = "http://www.mysite.net/images/"; 
        { 
          echo '<img src="'.$img_url.$result['Images'].'" />'; 
        } 
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致