【问题标题】:Images not appearing in hostgator but appearing in localhost图像未出现在 hostgator 中但出现在 localhost
【发布时间】:2017-09-29 22:36:52
【问题描述】:

我在根目录的成员文件夹中有一组上传的图像。 页面加载时图像未显示。 当我检查元素时,我得到了正确的图片名称和其他参数,但图片没有显示出来。

This is the output image i'm getting

This is the result of inspect element

我在 localhost 中使用了相同的代码,它工作正常并且所有图像都已加载。但是现在我切换到 hostgator 它不显示图像。

<tr style="color:grey; font-size:15px;">
    <td width="1%"><? echo $headdata['USERID']; ?></td>
    <td width="1%"><img src="/members/<? echo $headdata['USERPIC']; ?>" width="150" height="150"  ></td>
    <td width="1%"><? echo $headdata['NAME'];?></td>
    <td width="1%"><? echo $headdata['AGE'];?></td>
    <td width="1%"><? echo $headdata['SEX'];?></td>
    <td width="1%"><? echo $headdata['MOBILE'];?></td>
    <td width="1%"><? echo $headdata['TYPE'];?></td>

    <?
        $txtreceived = $headdata['ID'];
        $IDS = encrypt_decrypt('encrypt', $txtreceived);
    ?>

    <td width="1%">
        <a href="editmemberdetails.php?UpdateId=<? echo $IDS; ?>" class="btn    btn-sm btn-primary">
            <i class="fa fa-pencil"></i>
        </a>
        <a href="editmember.php?UpdateId=<? echo $IDS; ?>" class="btn btn-sm btn-danger">
            <i class="fa fa-times"></i>
        </a>
    </td>
</tr>

【问题讨论】:

  • 检查你的文件夹path
  • 路径是否正确?
  • 试试这个&lt;td width="1%"&gt;&lt;img src="http://www.your_domain.com/path/members/&lt;? echo $headdata['USERPIC']; ?&gt;" width="150" height="150" &gt;&lt;/td&gt;
  • 不要使用短标签

标签: javascript php html html-table


【解决方案1】:

如果您在 hostgator 中的代码不在根目录(www 或 public_html)中,并且在您的本地主机中,您的代码在 www root 或 public_html 中,那么您的 src 路径无法在服务器上运行,因为您在 @987654322 中添加了 / @

所以请检查src="./members/..." 仍然无法正常工作,然后检查服务器中的members 文件夹权限,它对于apache 用户应该是可读写的755。并检查$headdata['USERPIC']; 的文件是否存在于members 文件夹中?

【讨论】:

    猜你喜欢
    • 2021-07-27
    • 2015-04-07
    • 1970-01-01
    • 1970-01-01
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 2020-10-12
    • 1970-01-01
    相关资源
    最近更新 更多