我試圖從服務器中的文件夾中的所有圖像通過PHP檢索到我的網頁。
在本地服務器上,它們顯示正常,但在主服務器上,圖像不顯示,顯示錯誤404未找到當我從服務器文件夾中檢索到圖像時,圖像不顯示在網頁中
即使圖像存在。
請幫我擺脫這一點。這些圖像位於Big Rock服務器中。
這裏是我的代碼:
$filename = $_POST['file'];
echo '<table class="table1" border="0" width="100%" >';
echo "<tr>";
echo "<td class='td1'>";
$images = glob($_SERVER["DOCUMENT_ROOT"].
"/admin/gallery/".$filename.
"/*.*");
$count = 0;
foreach($images as $image) {
echo '<a href="'.$image.
'" target="_blank"><img src="'.$image.
'"class="img-rounded mySlides" width="200" height="150"/></a><br />';
if ($count < 3) {
$count++;
echo "</td>";
echo "<td class='td1'>";
} else {
echo "</tr>";
$count = 0;
echo "<tr>";
echo "<td class='td1'>";
}
}
請檢查圖像的相對路徑。檢查這裏的例子[https://stackoverflow.com/questions/44212488/cant-find-correct-relative-paths-of-css-background-image/44212527?noredirect=1#comment75437135_44212527] –