한번봐주세요
본문
여기보면 path부분에 한군데 image 폴더에만 그림이 출력되게되어있는데 만약
$path = "./list/1111/image1";
<a href="../sightseeing_list/list/1111/2222.php"/>
<li><img src="./list/1111/image1/<?=$img?>" alt="map" width=50% height=200 align="left"
하나를 더 만들려면 또 하나를 더 만들어야하자나요 밑에처럼 혹시 path를 더 생성안하고 하나의 path에 다 표현할수는 없나요?
$path = "./list/3333/image1";
<a href="../sightseeing_list/list/3333/4444.php"/>
<li><img src="./list/3333/image1/<?=$img?>" alt="map" width=50% height=200 align="left"
밑에를 예로 들었습니다 이렇게하닌까 안되더라고요^^;;
$path = "(./list/1111/image1),(./list/333/image1)";
<a href="../sightseeing_list/list/1111/2222.php"/>
<li><img src="./list/1111/image1/<?=$img?>" alt="map" width=50% height=200 align="left"
<a href="../sightseeing_list/list/3333/4444.php"/>
<li><img src="./list/3333/image1/<?=$img?>" alt="map" width=50% height=200 align="left"
<?
$path = "./list/1111/image1";
$entrys = array();
$dirs = dir($path);
while(false !== ($entry = $dirs->read())){
if(($entry != '.') && ($entry != '..')) {
if(!is_dir($path.'/'.$entry)) {
$entrys[] = $entry;
}
}
}
$dirs->close();
?>
<nav>
<ul>
<a href="../sightseeing_list/list/1111/2222.php"/>
<?
foreach($entrys as $img){
?>
<li><img src="./list/1111/image1/<?=$img?>" alt="map" width=50% height=200 align="left" border="1"/><br>
<?
}
?>
답변 1
하나의 변수에는 하나의 값만 넣어야 합니다.
$path_1 = "111";
$path_2 = "222";
이런식으로
말씀하시는 방식으로 하려면 변수에 배열로 넣어야 하는데요~
$path = array ("111", 222"); 이렇게 넣으면 됩니다.
그리고 사용은
$path[0];
$path[1];
이런식으로 사용해야 됩니다.
echo $path[0];
이렇게 하면 값은
111 이렇게 나옵니다..
도움이 되시길....