~~~
<?pph
// 根據身份證號,自動返回對應的星座
function get_xingzuo($cid) {
$cid = getIDCard($cid);
if (!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;
}
// 根據身份證號,自動返回對應的生肖
function get_shengxiao($cid) {
$cid = getIDCard($cid);
if (!isIdCard($cid)) return '';
$start = 1901;
$end = $end = (int)substr($cid,6,4);
$x = ($start - $end) % 12;
$value = "";
if ($x == 1 || $x == -11) {$value = "鼠";}
if ($x == 0) { $value = "牛";}
if ($x == 11 || $x == -1) {$value = "虎";}
if ($x == 10 || $x == -2) {$value = "兔";}
if ($x == 9 || $x == -3) {$value = "龍";}
if ($x == 8 || $x == -4) {$value = "蛇";}
if ($x == 7 || $x == -5) {$value = "馬";}
if ($x == 6 || $x == -6) {$value = "羊";}
if ($x == 5 || $x == -7) {$value = "猴";}
if ($x == 4 || $x == -8) {$value = "雞";}
if ($x == 3 || $x == -9) {$value = "狗";}
if ($x == 2 || $x == -10) {$value = "豬";}
return $value;
}
function get_xingbie($cid,$comm=0) { //根據身份證號,自動返回性別
$cid = getIDCard($cid);
if (!isIdCard($cid)) return '';
$sexint = (int)substr($cid,16,1);
if($comm >0){
return $sexint % 2 === 0 ? '女士' : '先生';
}else{
return $sexint % 2 === 0 ? '女' : '男';
}
}
// 功能:把15位身份證轉換成18位
function getIDCard($idCard) {
// 若是15位,則轉換成18位;否則直接返回ID
if (15 == strlen ( $idCard )) {
$W = array (7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2,1 );
$A = array ("1","0","X","9","8","7","6","5","4","3","2" );
$s = 0;
$idCard18 = substr ( $idCard, 0, 6 ) . "19" . substr ( $idCard, 6 );
$idCard18_len = strlen ( $idCard18 );
for($i = 0; $i < $idCard18_len; $i ++) {
$s = $s + substr ( $idCard18, $i, 1 ) * $W [$i];
}
$idCard18 .= $A [$s % 11];
return $idCard18;
} else {
return $idCard;
}
}
?>
~~~
- PHP新特性
- 一些常識
- PHP常見header頭
- Nginx配置文件
- 常用工具類
- PHP實現的一個時間幫助類
- PHP原生生成EXCEL
- PHP地理位置計算
- PHP獲取服務器狀態
- 駝峰轉下劃線
- 百度地圖兩點坐標距離計算
- 判斷是否是url
- 郵件發送類
- 阿拉伯數字轉化為大寫
- 獲取漢字首個拼音
- 根據身份證號獲取星座
- 生成驗證碼類
- 生成唯一ID
- 身份證驗證類
- PHP中文轉拼音
- curl獲取網頁內容
- 快遞查詢api
- 快遞API類
- 上傳圖片類
- 股票類
- 找回密碼類
- 校驗數據規則
- PHP獲取收集相關信息
- 字符串截取助手函數
- 網頁中提取關鍵字
- 檢測瀏覽器語言
- PHP實現微信紅包拆分算法
- 常用函數
- 微信相關
- 網絡知識
- LX1 Laravel / PHP 擴展包視頻教程
- THINKPHP5學習
- 高級查詢
- Vue學習
- Vue全家桶
- Vue-CLI 3.x 自動部署項目至服務器
- Vue2全家桶
- Vue2全家桶之一:vue-cli(vue腳手架)超詳細教程
- Vue2全家桶之二:vue-router(路由)詳細教程,看這個就夠了
- Vue2全家桶之三:vue-resource(不推薦)----axios(推薦)
- 前端相關
- sublime text3 配置less編譯環境
- 服務器搭建相關
- supervisor
- Supervisor 安裝與配置 Linux進程管理
- supervisor 永不掛掉的進程 安裝以及使用
- Supervisor進程管理&開機自啟
- php實現定時任務
- 使用sublime text3 連接sftp/ftp(遠程服務器)
- Redis相關
- linux服務器重啟后導致redis數據丟失
- 搜索引擎SEO
- 百度收錄權威鏈接,指向真正需要收錄的地址rel
- 軟件相關
- sublime
- sublime Text3修改側邊欄的主題
- sublime和vscode比較
- Acrylic DNS Proxy 使用方法
- 技術類網址收藏