回答編集履歴
5
修正
answer
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
[file_exists](https://www.php.net/manual/ja/function.file-exists.php)で画像があれば表示するようにしてみてはどうでしょうか。
|
2
2
|
```PHP
|
3
3
|
<?php
|
4
|
-
for ($i=1; $i<=5; $i++){
|
4
|
+
for ( $i=1; $i<=5; $i++ ) {
|
5
5
|
// 画像のフルパス
|
6
6
|
$filename = '/path/images/'.$row['shop_name'].'/'.$i.'.jpg';
|
7
7
|
|
4
修正
answer
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
// 画像があれば表示
|
9
9
|
if ( file_exists($filename) ) {
|
10
|
-
echo'<img src="images/'.$row['shop_name'].'/'.$i.'.jpg">';
|
10
|
+
echo '<img src="images/'.$row['shop_name'].'/'.$i.'.jpg">';
|
11
11
|
}
|
12
12
|
}
|
13
13
|
|
3
修正
answer
CHANGED
@@ -2,12 +2,14 @@
|
|
2
2
|
```PHP
|
3
3
|
<?php
|
4
4
|
for ($i=1; $i<=5; $i++){
|
5
|
+
// 画像のフルパス
|
5
|
-
|
6
|
+
$filename = '/path/images/'.$row['shop_name'].'/'.$i.'.jpg';
|
6
|
-
|
7
|
-
if ( file_exists($filename) ) {
|
8
|
-
echo'<img src="images/'.$row['shop_name'].'/'.$i.'.jpg">';
|
9
|
-
}
|
10
|
-
}
|
11
7
|
|
8
|
+
// 画像があれば表示
|
9
|
+
if ( file_exists($filename) ) {
|
10
|
+
echo'<img src="images/'.$row['shop_name'].'/'.$i.'.jpg">';
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
12
14
|
?>
|
13
15
|
```
|
2
修正
answer
CHANGED
@@ -1,1 +1,13 @@
|
|
1
|
-
[file_exists](https://www.php.net/manual/ja/function.file-exists.php)で画像があれば表示するようにしてみてはどうでしょうか。
|
1
|
+
[file_exists](https://www.php.net/manual/ja/function.file-exists.php)で画像があれば表示するようにしてみてはどうでしょうか。
|
2
|
+
```PHP
|
3
|
+
<?php
|
4
|
+
for ($i=1; $i<=5; $i++){
|
5
|
+
$filename = '/path/images/'.$row['shop_name'].'/'.$i.'.jpg';
|
6
|
+
|
7
|
+
if ( file_exists($filename) ) {
|
8
|
+
echo'<img src="images/'.$row['shop_name'].'/'.$i.'.jpg">';
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
?>
|
13
|
+
```
|
1
修正
answer
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
[file_exists](
|
1
|
+
[file_exists](https://www.php.net/manual/ja/function.file-exists.php)で画像があれば表示するようにしてみてはどうでしょうか。
|