douhe4608 2011-10-29 22:50
浏览 21

如何在PHP中每两周显示不同的图像?

how can I show a different image every 2 weeks?, i have 8 images to show, like this. week 1 image1 week 2 image1 week 3 image2 week 4 image2 ... week 17 image1


<?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 correct? can be improved?

  • 写回答

4条回答 默认 最新

  • dongshuo9350 2011-10-29 22:55
    关注

    save the image paths to a file, every time the function is called check the last modified on the file, if the last modified > 2 weeks, open the file, move the image to the bottom, save the file.

    评论

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题