<?php

namespace App\Lib;

class Tools
{
  //查询某天是星期几
  public static function GetWeekName($date)
  {
    $dayOfWeek = date('N', strtotime($date)); // 获取星期几，1代表星期一，7代表星期日
    $weekname='';
    switch ($dayOfWeek) {
      case 1:
        $weekname= "星期一";
        break;
      case 2:
        $weekname= "星期二";
        break;
      case 3:
        $weekname="星期三";
        break;
      case 4:
        $weekname= "星期四";
        break;
      case 5:
        $weekname= "星期五";
        break;
      case 6:
        $weekname= "星期六";
        break;
      case 7:
        $weekname= "星期日";
        break;
      default:
        $weekname= "无效日期";
    }
    return $weekname;
  }
}
