By - lmypersonPosted on 2025年7月11日Posted in 工作php从身份证获取性别方法$sex = substr($card, (strlen($card)==18 ? -2 : -1), 1) % 2 ? '1' : '0'; echo $sex//1为男 0为女 0 0