0
我有一些代碼:PHP不查找文件
<div id="image-cycle-container">
<ul id="image-cycle">
<?php
//Select the folder which the images are contained within and store as an array
$imgDir = get_stylesheet_directory_uri() . '/img/image-cycle/';
$images = glob($imgDir . '*.jpg');
foreach($images as $image){
echo 'something';
echo "<li><img src='".$image."' /></li>\n";
}
?>
</ul>
,問題是,沒有圖像顯示(雖然他們絕對不存在)。我可以絕對引用它們,但PHP沒有找到任何東西/數組是空的。我使用WAMP開發網站,我開始懷疑這是否是我生活中的禍根......
'$ image'的值是什麼? –
get_stylesheet_directory_uri()的輸出是什麼? – KyleK
@newfurniturey $ imgDir的值是「http://127.0.0.1/xxxx/wp-content/themes/responsive-child/img/image-cycle/」,其中xxxx是網站所在的文件夾。這是一個問題?似乎我不能鏈接沒有它鏈接... – Titus