One,
preg_match('/[\x{4e00}-\x{9fa5}A-Za-z0-9_]+/u', $userInfo['nickname'],$matches)
$userInfo['nickname'] = implode('',$matches);
Note: This method will remove the nickname in the rest of the image will remain
two,
base64_encode (coding)
base64_decode (decoding)
Note: When stored in the database encoding, decoding (the perfect solution) while reading