中禁用小数点转换时,我提交1,000,000
,它显示为1
,但如果我提交1000000
,它显示为1,000,000
。无论提交方式如何,我都希望输出为1,000,000
。请帮助!如何在php
这里是PHP代码:
if(!function_exists('get_property_price')){
function get_property_price(){
global $post;
$price_digits = doubleval(get_post_meta($post->ID, 'REAL_HOMES_property_price', true));
if($price_digits){
$currency = get_theme_currency();
$price_post_fix = get_post_meta($post->ID, 'REAL_HOMES_property_price_postfix', true);
$decimals = intval(get_option('theme_decimals'));
$decimal_point = get_option('theme_dec_point');
$thousands_separator = get_option('theme_thousands_sep');
$currency_position = get_option('theme_currency_position');
$formatted_price = number_format($price_digits,$decimals, $decimal_point, $thousands_separator);
if($currency_position == 'after'){
return $formatted_price . $currency. ' ' . $price_post_fix;
}else{
return $currency . $formatted_price . ' ' . $price_post_fix;
}
}else{
return __('NA','framework');
}
}
}
if(!function_exists('property_price')){
function property_price(){
echo get_property_price();
}
}
if(!function_exists('get_custom_price')){
function get_custom_price($amount){
$amount = doubleval($amount);
if($amount){
$currency = get_theme_currency();
$decimals = intval(get_option('theme_decimals'));
$decimal_point = get_option('theme_dec_point');
$thousands_separator = get_option('theme_thousands_sep');
$currency_position = get_option('theme_currency_position');
$formatted_price = number_format($amount,$decimals, $decimal_point, $thousands_separator);
if($currency_position == 'after'){
return $formatted_price . $currency;
}else{
return $currency . $formatted_price;
}
}else{
return __('NA','framework');}}}
你的问题有点不对。 PHP不会将此值转换为小数分隔值,您的框架可以。在您的主题中查找“theme_thousands_sep”和“theme_dec_point”选项。 – GuyT 2014-10-03 09:17:20
[解析数字但保留负数](http:// stackoverflow。com/questions/19964723/parse-a-number-but-keep-negatives) – Tigger 2014-10-03 09:40:34
GuyT我试图从function.php中禁用它们bt没有任何更改 – 2014-10-03 10:20:09