从2000年1月1日开始“三天打渔,两天晒网”算,求任意一天打渔还是晒网? 从2000年1月1日开始“三天打渔,两天晒网”算,求任意一天打渔还是晒网? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 strtotime……可计算一定范围内的, <?php$s=strtotime('2000-1-1');$time=strtotime('2012-5-11');$sum=($time-$s)/86400;$day=$sum%5;echo $day<=3?'打渔':'晒网'; N%5 >=1 && <= 3 的打渔 否则 晒网 <?php$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'); 计算的不准是因为天数差计算有误给个最笨的方法,供你参考。你不是在做作业吗?$t = strtotime('2000-1-1');$i = 0;while($t < time()) { echo date('Y-m-d', $t) . ' '. ($i < 3 ? '打渔' : '晒网') . PHP_EOL; $t = strtotime('+1 day', $t); $i = ($i+1) % 5;} <form action="fish.php">年份:<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;}?> <form action="fish.php">年份:<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> 求zend studio配置svn详细教程 如何得到iframe的加载时间? 打印 循环十个数字出来 急!!function中对数组的修改无效!! php怎么样用通配符删除一类文件 554 this mail is rejected by antispam system 大家上傳文件的目錄是怎麼安排的? 大型网站的内容后台管理系统!!!!!! 怎么判断输入的是否是数字 请问各位大虾,一个模式匹配的问题。急!!! 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>