警告:number_format() 期望参数 1 为双精度,给出字符串 [英] Warning: number_format() expects parameter 1 to be double, string given

查看:28
本文介绍了警告:number_format() 期望参数 1 为双精度,给出字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面滑块出现此错误:

I got this Error on my Page slider:

警告:number_format() 期望参数 1 为 double,字符串在/home/globalar/public_html/wp-content/themes/automotive_s1/includes/slider.php 第 30 行

Warning: number_format() expects parameter 1 to be double, string given in /home/globalar/public_html/wp-content/themes/automotive_s1/includes/slider.php on line 30

<?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 '';
}

推荐答案

您应该检查 $fields['price'] 中的值.

You should check what value is inside $fields['price'].

就去做:

var_dump($fields['price']);

您可能有一些空格或 , 而不是 .

It's possible you have some spaces or , instead of .

这篇关于警告:number_format() 期望参数 1 为双精度,给出字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆