从2000年1月1日开始“三天打渔,两天晒网”算,求任意一天打渔还是晒网?
解决方案 »
- PHP 程序找错(处理冗沉重复信息)
- <img src="img/captcha.php?nocache=<?php echo time(); ?>" alt=""/>中的nocache是啥意思
- 求助,服务器刷新数据问题
- php传入mysql数据中文为乱码问题,同样显示也为乱码
- Rose运行时出错
- PHP版式问题
- Notice: mysql_connect(): SQL safe mode in effect - ignoring host/user/password information in E:\php\chinaTaiWaiSeerver\dgtsfron
- 对 MySQL 的 SHOW TABLE STATUS
- 斑主,你看java多历害,连这种问题都能描述出来。
- 难!如何识别非法用户通过url传递变量破坏系统?
- php-5.3.3 连接 mssql 失败?
- 请问如何将mysql_fetch_object得到的对象塞到数组里面?
$s=strtotime('2000-1-1');
$time=strtotime('2012-5-11');
$sum=($time-$s)/86400;
$day=$sum%5;
echo $day<=3?'打渔':'晒网';
>=1 && <= 3 的打渔 否则 晒网
$s=strtotime('2000-1-1');
$time=strtotime('2001-5-27');
$sum=($time-$s)/86400;
$day=$sum%5+1;
echo $day<=3?'打渔':'晒网';
function GetText($day)
{
$nowDay = date("z", strtotime($day)) + 1;
Return ($nowDay%5 >= 1 && $nowDay%5 <=3) ? '晒网' : '打鱼';
}echo GetText('2011-01-01');
function GetText($day)
{
$nowDay = date("z", strtotime($day)) + 1;
Return ($nowDay%5 >= 1 && $nowDay%5 <=3) ? '打鱼' : '晒网';
}echo GetText('2011-01-01');
$i = 0;
while($t < time()) {
echo date('Y-m-d', $t) . ' '. ($i < 3 ? '打渔' : '晒网') . PHP_EOL;
$t = strtotime('+1 day', $t);
$i = ($i+1) % 5;
}
年份:
<input type="text" name="year"/>
<br/>
月份:
<input type="text" name="month"/>
<br/>
日期:
<input type="text" name="day"/>
<br/>
<input type="submit" name="submit1" value="提交"/>
</form><?php
$y=$_GET['year'];
$m=$_GET['month'];
$d=$_GET['day'];
function is_leap($x){
if($x%4==0&&$x%100!=0||$x%400==0)
return 1;
else
return 0;
}
$s=$d;
if(is_leap($y)==1)
$mon[2]=29;
for($i=2000;$i<$y;$i++){
if(is_leap($i)==1)
$s=$s+1;
}
echo $s;
switch ($s%5)
{
case 1:echo"打渔";break;
case 2:echo"打渔";break;
case 3:echo"打渔";break;
case 4:echo"晒网";break;
case 0:echo"晒网";break;
}
?>
年份:
<input type="text" name="year"/>
<br/>
月份:
<input type="text" name="month"/>
<br/>
日期:
<input type="text" name="day"/>
<br/>
<input type="submit" name="submit1" value="提交"/>
</form>