作者lusaka (gary.lusifa)
看板PHP
标题Re: [请益] 请教一个日期条件设计问题
时间Wed Jan 24 22:29:43 2018
由於我的PHP网页的程式是5.2.9
所以先依据目前可以使用的状态写成以下算是分享一下。如果有甚麽可以加强的方式,
可以请先进建议
<?
$nowdate= date("Y-m-d");
$birthday = 1911-01-02;
$birthday=date("Y")."-".date("m",strtotime($birthday))."-"
.date("d",strtotime($birthday));
$birthday_s=date("Y")."-".date("m",strtotime($birthday))."-01";
$birthday1 = strtotime($birthday);
$start_Date = date("Y-m-01", strtotime ("-1 month", $birthday1));
$start_Date2= mb_substr($start_Date,0,10);
$startDate1=strtotime($start_Date);
$end_Date =date ("Y-m-d", strtotime ("+2 month -1 day", $startDate1));
?>
<?
if(($nowdate > $start_Date) && ($nowdate < $end_Date)){ //图案显示条件
?>
<!--点选图案时,显示使用POST语法-->在另外一个网页要读取,要显示
<a id="birthday" class="show"
href="aa.php?&PB_BEGINTIME=<?=$birthday_s?>&PB_ENDTIME=<?=$end_Date?>">
</a>
<?}?>
?>
另外想请教另外的先进,我有资料是存在资料库,想请教用甚麽程式做法可以在点选时,
直接呼叫资料库中的纪录显示,我要的资料。
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 175.180.202.12
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/PHP/M.1516804186.A.83E.html