我的页面滑块上出现此错误:
警告:number_format()期望参数1为double,第30行的/home/globalar/public_html/wp-content/themes/automotive_s1/includes/slider.php中给出了字符串
<?php
if $str = floatval($str); ($post->post_type == "gtcd") {
the_title();
if (isset( $fields['price'])) {
echo ' | <span class="price_slider">'.' '.$symbols['currency'];
echo number_format($fields['price']).'</span> ';
} else {
echo '';
}
Run Code Online (Sandbox Code Playgroud)
Far*_*mar 19
$fields['price']='8, 9858';
echo number_format((float)$fields['price']);
Run Code Online (Sandbox Code Playgroud)
使用(float)解析正确的方法
您应该检查里面的值$fields['price']。
做就是了:
var_dump($fields['price']);
Run Code Online (Sandbox Code Playgroud)
您可能有一些空格或,代替.
| 归档时间: |
|
| 查看次数: |
49566 次 |
| 最近记录: |