1。判断字符串是否为空,非空时检测输入字符串是否为汉字、平假名、片假名或全角数字 if ( empty ( $paymentway -> bank_name)) { $_REQUEST [ " ERROR_MESSAGE " ] = BANK_NAME_NOT_INPUT; $_REQUEST [ " PAYMENT_EDIT_SEARCH_RESULT " ] = $paymentway ; $doContinueFlg = false ;} else if ( ! mb_ereg( " ^([一-龠]|[ぁ-ん]|[ァ-ヴ]|[a-zA-Z0-9])+$ " , $paymentway -> bank_name)){ $_REQUEST [ " ERROR_MESSAGE " ] = BANK_NAME_INPUT_ERROR; $_REQUEST [ " PAYMENT_EDIT_SEARCH_RESULT " ] = $paymentway ; $doContinueFlg = false ;} 2。判断字符串是否为空,非空时检测输入字符串是否为数字 if ( empty ( $paymentway -> bank_account)){ $_REQUEST [ " ERROR_MESSAGE " ] = BANK_ACCOUNT_NOT_INPUT; $_REQUEST [ " PAYMENT_EDIT_SEARCH_RESULT " ] = $paymentway ; $doContinueFlg = false ;} else { if ( ! is_numeric ( $paymentway -> bank_account)){ $_REQUEST [ " ERROR_MESSAGE " ] = BANK_ACCOUNT_NOT_ILLEGAL; $_REQUEST [ " PAYMENT_EDIT_SEARCH_RESULT " ] = $paymentway ; $doContinueFlg = false ; } } 3。判断字符串是否为空,非空时检测输入字符串是否合法邮编 if ( empty ( $paymentway -> post_office_mark)){ $_REQUEST [ " ERROR_MESSAGE " ] = POST_OFFICE_MARK_NOT_INPUT; $_REQUEST [ " PAYMENT_EDIT_SEARCH_RESULT " ] = $paymentway ; $doContinueFlg = false ; } else { if ( ! mb_ereg( " ^[0-9]{3}[-]?[0-9]{4}$ " , $paymentway -> post_office_mark)){ $_REQUEST [ " ERROR_MESSAGE " ] = POST_OFFICE_MARK_NOT_ILLEGAL; $_REQUEST [ " PAYMENT_EDIT_SEARCH_RESULT " ] = $paymentway ; $doContinueFlg = false ; }}