Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php strottime;选择特定的日期;星期四(今天)不上班_Php_Strtotime - Fatal编程技术网

Php strottime;选择特定的日期;星期四(今天)不上班

Php strottime;选择特定的日期;星期四(今天)不上班,php,strtotime,Php,Strtotime,我认为我的工作做得很好,然后意识到今天是一个特别的月份,它变得很复杂 这就是我所拥有的: <!-- determines first Wednesday and first Thursday of the month to echo something different than the rest of the days of the month. --> <?php $firstwed = strtotime("first Wednesday, first Thursday

我认为我的工作做得很好,然后意识到今天是一个特别的月份,它变得很复杂

这就是我所拥有的:

<!-- determines first Wednesday and first Thursday of the month to echo something different than the rest of the days of the month. -->
<?php
$firstwed = strtotime("first Wednesday, first Thursday". date("F Y"));
$now = strtotime('today'); 

if( $firstwed == $now) {
  echo "Registration is closed until our next event!";
  // do something
} else {
  echo 'REGISTER AND PAY ONLINE HERE';
  // do something else
}
?>

但我昨天也需要它(周三,但正好是上个月)

如果我只是把目标定在今天(星期四),它甚至似乎都不起作用

基本上,故事是,每个月的第一个星期五,他们都有一个会议,需要在星期三和星期四之前注册结束;然后在周五重新开放

请帮忙,非常感谢


*编辑:还有人能在这个问题上提供帮助吗?我仍然没有取得任何进展。

你的问题很难理解,
如果我理解正确,
以下是经过简化的增强版本:-

$today = explode(',', date('d,D,t'));  // month day, week day, days in month
switch ($today[1])
{
  case "Wed":
    if (($today[0]+2 > $today[2]) || $today[0] <=7)
    {
      //closed
    }
  case "Thu":
    if (($today[0]+1 > $today[2]) || $today[0] <=7)
    {
      //closed
    }
    break;
}
$today=explode(',,date('d,d,t');//月日、周日、月内日
交换机($today[1])
{
案件“Wed”:

如果($today[0]+2>$today[2])| |$today[0]$today[2])| |$today[0]您的版本实际上是在比较第二个星期四:

php > echo date('c', strtotime('first wednesday, first thursday'));
2011-12-08T00:00:00-06:00   <--- dec 8th = thursday, but not **THE** first thursday
php > echo date('c', strtotime('first wednesday'));
2011-12-07T00:00:00-06:00   <--- dec 7th = wednesday
php > echo date('c', strtotime('today'));
2011-12-01T00:00:00-06:00   <-- dec 1st = thursday <-- actual first thursday of the emonth
不是很直观


你最好使用正式的约会电话来获得“一周中的某一天”查看当月的实际第一天,看看是不是周三/周四。

我知道,对不起,现在事情变得复杂了。我试试看;如果紧张的话,这也行吗:一个月的第一个星期五在第一天;然后我需要在上个月的星期三和星期四之前确定目标。
php > echo date('c', strtotime('first thursday december'));
2011-12-08T00:00:00-06:00
php > echo date('c', strtotime('thursday december'));
2011-12-01T00:00:00-06:00
php > echo date('c', strtotime('thursday'));
2011-12-01T00:00:00-06:00