if (isset($_POST['reg_user'])) {
// receive all input values from the form
$CUSTOMER_ID=($_POST['customerid']);
$CUST_TYPE = ($_POST['customer_type']);
$APP_DATE=( $_POST['input_date']);
$PRODUCT_ID = ( $_POST['productid']);
$ACTION = ($_POST['new_loan']);
$CURRENCY= ($_POST['currency']);
$LOAN_PURPOSE = ( $_POST['loan_purpose']);
$AA_SECTOR= ( $_POST['aa_sector']);
$GU_RECORD_ID=( $_POST['record_id']);
$DISB_ACCOUNT = ( $_POST['disb_account']);
$REPAY_ACCOUNT= ( $_POST['repay_account']);
$CHARGE_ACCOUNT=($_POST['charge_account']);
我想将值转换为“。”。例如。从$ CUSTOMER_ID到$ CUSTOMER.ID,从CUST_TYPE到CUST.TYPE
答案 0 :(得分:0)
$subject = 'CUST_TYPE';
$pattern = '/_/';
$replacement = '.';
$result = preg_replace($pattern, $replacement, $subject);
echo $result;
给予:
CUST.TYPE
所以快速而肮脏的解决方案是:
$pattern = '/_/';
$replacement = '.';
$CUSTOMER_ID=($_POST['customerid']);
$CUST_TYPE = ($_POST['customer_type']);
$APP_DATE=( $_POST['input_date']);
$PRODUCT_ID = ( $_POST['productid']);
$ACTION = ($_POST['new_loan']);
$CURRENCY= ($_POST['currency']);
$LOAN_PURPOSE = ( $_POST['loan_purpose']);
$AA_SECTOR= ( $_POST['aa_sector']);
$GU_RECORD_ID=( $_POST['record_id']);
$DISB_ACCOUNT = ( $_POST['disb_account']);
$REPAY_ACCOUNT= ( $_POST['repay_account']);
$CHARGE_ACCOUNT=($_POST['charge_account']);
$CUSTOMER_ID= preg_replace($pattern, $replacement, $CUSTOMER_ID);
$CUST_TYPE = preg_replace($pattern, $replacement, $CUST_TYPE);
$APP_DATE= preg_replace($pattern, $replacement, $APP_DATE);
$PRODUCT_ID = preg_replace($pattern, $replacement, $PRODUCT_ID);
$ACTION = preg_replace($pattern, $replacement, $ACTION);
$CURRENCY= preg_replace($pattern, $replacement, $CURRENCY);
$LOAN_PURPOSE = preg_replace($pattern, $replacement, $LOAN_PURPOSE);
$AA_SECTOR= preg_replace($pattern, $replacement, $AA_SECTOR);
$GU_RECORD_ID= preg_replace($pattern, $replacement, $GU_RECORD_ID);
$DISB_ACCOUNT = preg_replace($pattern, $replacement, $DISB_ACCOUNT);
$REPAY_ACCOUNT= preg_replace($pattern, $replacement, $REPAY_ACCOUNT);
$CHARGE_ACCOUNT= preg_replace($pattern, $replacement, $CHARGE_ACCOUNT);