身分證驗證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
相關文章

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

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


Hot Tools

熱門文章
丟失記錄:Bloom&Rage -Corey和Dylan的鎖組合
19Feb2025手游攻略
Longvinter:完整的釣魚指南
21Feb2025手游攻略
KCD 2:Zhelejov Marshes的地圖位置和解決方案
19Feb2025手游攻略
Hello Kitty Island冒險:重新啟動機器人任務演練
16Feb2025手游攻略
王國來:拯救2-如何獲得法蘭克福鋼
08Feb2025手游攻略