<?php include("include/function.php"); //第1步 取得亂數 $handn=rand(1,3); //第2步 設定檔名 if($handn==1){ $handn="scissors.png"; }elseif($handn==2){ $handn="rock.png"; }elseif($handn==3){ $handn="paper.png"; } ?> <div class="rand"> <img src="images/<?php echo $handn; ?>"/>> </div>