我怎樣才能每2周顯示一幅不同的圖像?我有8幅圖像可以顯示,就像這樣。 周1 image1的 周2圖像1 每週3圖像2 4圖像2 周...... 周17 image1的如何在php中每兩週顯示不同的圖像?
<?php
$check=date('W');
$img1 = array ('1','2','11','12','21','22','31','32','41','42','51','52');
$img2 = array ('3','4','13','14','23','24','33','32','43','44');
$img3 = array ('5','6','15','16','25','26','35','36','45','46');
$img4 = array ('7','8','17','18','27','28','37','38','47','48');
$img5 = array ('9','10','19','20','29','30','39','40','49','50');
if (in_array($check,$img1,true)){
echo "show img1";
}
if (in_array($check,$img2,true)){
echo "show img2";
}
if (in_array($check,$img3,true)){
echo "show img3";
}
if (in_arrat($check,$img4,true)){
echo "show img4";
}
if (in_array($check,$img5,true)){
echo "show img5";
}
?>
it's是否正確?可以改進嗎?
當爲1星期? – salathe