<?php //1.取得亂數 $handn = rand(1,3); //echo $hand; //2.設定檔名 if($handn == 1 ){ $hand="scissors.png"; }else if($handn == 2){ $hand ="rock.png"; }else { $hand = "paper.png"; } // 3. 到正確的地方去 echo 檔名即可 //echo $hand; ?>