我在服务器上的公共 html 文件夹中有一个 wordpress。
我想显示文件夹 Public_html--->Trial-->Wordpress_site-->uploads 中的图像
下面是page.php代码
<?php
$directory = dirname(__FILE__).'/uploads';
echo $directory;
try {
// Styling for images
foreach ( new DirectoryIterator("/" . $directory) as $item ) {
if ($item->isFile()) {
echo "<div class=\"expand_image\">";
$path = "/" . $directory . "/" . $item;
echo $path;
echo "<img src=/"". $path . "\" width=861 height=443 />";
echo "</div>";
}
}
}
catch(Exception $e) {
echo 'No images found for this player.<br />';
}
?>
图像没有显示出来。。
有谁知道一样吗??
编辑1
我觉得这句话有问题
echo "<img src=/"". $path . "\" width=861 height=443 />";
是吗?
编辑2
//home/softwar2/public_html/Pradnnya_blog/wordpress_site/wp-content/themes/deep-red/our_results/4thpanelfinal.jpg
是我回显时得到的路径。