0
私は地元のサッカークラブでテレビ画面用のプログラムを調整しようとしています。私はすでにサイトを作っていましたが、今はもっとユーザーフレンドリーにしたいと思っています。htmlでphpを使用してスライドショーに画像を追加する
具体的には、誰かが特定のフォルダに画像を追加するだけで、フォルダ内のすべての画像をスライドショーで使用できるようにしたいと考えています。
コードの関連部分は以下のとおりです。
<html>
<head>
<script type="text/javascript" src="js/tabs.js"></script>
<script src="js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/slider.js"></script>
</head>
<body>
<div class="corner_1">
<?php include("inc/script.php"); ?>
</div>
<div class="slider" id="slider">
<ul>
<li style="background-image: url('http://homedir.com/images/IMG_4947.JPG'); no-repeat center center fixed;
background-repeat: no-repeat;
background-size: 100% 100%;
background-position: center top;
background-attachment: fixed;">
</li>
<li style="background-image: url('http://homedir.com/images/IMG_4939.JPG'); no-repeat center center fixed;
background-repeat: no-repeat;
background-size: 100% 100%;
background-position: center top;
background-attachment: fixed;">
</li>
<li style="background-image: url('http://homedir.com/images/IMG_4922.JPG'); no-repeat center center fixed;
background-repeat: no-repeat;
background-size: 100% 100%;
background-position: center top;
background-attachment: fixed;">
</li>
</ul>
</div>
</body>
</html>
は、私はPHPでのglob()およびエコー機能で何かを作ってみましたが、それは仕事を得ることができませんでした:イメージは、ハードコードされていることに注意してください。
あなたはこれが正しいと確信していますか?予期しないEOFエラーが発生する。 – Jaspervb
どのように?構文は賢明ですか? – Rasclatt
構文は正しいです。この行の配列を取得する必要があります: '$ dir = scandir($ path);'。 '$ path'が有効であることを確認する必要があります。 'echo(is_dir($ path))? '有効': '有効ではありません'; exit; 'ディレクトリが存在することを確認します。 – Rasclatt