搜尋
身分證驗證PHP類
class IdcardAction extends Action{
  function get_xingzuo($cid) { 
    if (!$this->isIdCard($cid)) return '';
    $bir = substr($cid,10,4);
    $month = (int)substr($bir,0,2);
    $day = (int)substr($bir,2);
    $strValue = '';
    if (($month == 1 && $day >= 20) || ($month == 2 && $day <= 18)) {
      $strValue = "水瓶座";
    } else if (($month == 2 && $day >= 19) || ($month == 3 && $day <= 20)) {
      $strValue = "双鱼座";
    } else if (($month == 3 && $day > 20) || ($month == 4 && $day <= 19)) {
      $strValue = "白羊座";
    } else if (($month == 4 && $day >= 20) || ($month == 5 && $day <= 20)) {
      $strValue = "金牛座";
    } else if (($month == 5 && $day >= 21) || ($month == 6 && $day <= 21)) {
      $strValue = "双子座";
    } else if (($month == 6 && $day > 21) || ($month == 7 && $day <= 22)) {
      $strValue = "巨蟹座";
    } else if (($month == 7 && $day > 22) || ($month == 8 && $day <= 22)) {
      $strValue = "狮子座";
    } else if (($month == 8 && $day >= 23) || ($month == 9 && $day <= 22)) {
      $strValue = "处女座";
    } else if (($month == 9 && $day >= 23) || ($month == 10 && $day <= 23)) {
      $strValue = "天秤座";
    } else if (($month == 10 && $day > 23) || ($month == 11 && $day <= 22)) {
      $strValue = "天蝎座";
    } else if (($month == 11 && $day > 22) || ($month == 12 && $day <= 21)) {
      $strValue = "射手座";
    } else if (($month == 12 && $day > 21) || ($month == 1 && $day <= 19)) {
      $strValue = "魔羯座";
    }
    return $strValue;
  }

 PHP根據身分證號,自動取得對應的星座函數,然後自動返回對應的星座,自動返回性別,判斷是否成年

免責聲明

本站所有資源皆由網友貢獻或各大下載網站轉載。請自行檢查軟體的完整性!本站所有資源僅供學習參考。請不要將它們用於商業目的。否則,一切後果都由您負責!如有侵權,請聯絡我們刪除。聯絡方式:admin@php.cn

相關文章

zod 與類別驗證器和類別轉換器zod 與類別驗證器和類別轉換器

19Dec2024

NestJS 中 zod 與類別驗證器和類別轉換器的比較 我對 zod 或類驗證器和類轉換器之間感到困惑,或者至少很好奇 作為 NestJS 中的驗證庫。 重點 直接去吧

如何使用 DateTime 類別驗證 PHP 中的日期字串?如何使用 DateTime 類別驗證 PHP 中的日期字串?

17Dec2024

使用 PHP 的 DateTime 類別驗證日期字串在使用日期字串時,確保其有效性至關重要。 PHP 的 DateTime 類別...

身份驗證類型身份驗證類型

29Nov2024

身份驗證是驗證使用者身份的過程。這是一項基本的安全措施,可確保只有經過授權的個人才能存取系統和資料。隨著技術的進步,身份驗證方法也在不斷進步。讓我們來探索一些

驗證身分證是否合法的PHP函數驗證身分證是否合法的PHP函數

25Jul2016

驗證身分證是否合法的PHP函數

身分證校驗碼的計算身分證校驗碼的計算

25Jul2016

身分證校驗碼的計算

大陸身分證號處理類大陸身分證號處理類

25Jul2016

大陸身分證號處理類

See all articles