【问题标题】:Message: syntax error, unexpected ',' during number_format CI3消息:语法错误,在 number_format CI3 期间出现意外的 \',\'
【发布时间】:2023-01-20 16:34:37
【问题描述】:

有了这个正确的我可以将标签 {price} 发布到控制器,然后替换并从数据库中获取价值价格:

$template = str_replace('{price}', $row['price'], $template);

但问题是,在我的数据库中价格有值示例:42277 所以这是 422,77 欧元。

所以我现在尝试使用以下格式格式化数字:number_format

我尝试:

$template = str_replace('{price}', number_format(($row['price'], 2, '.', '') $template);

但我得到:

Message: syntax error, unexpected ','

在 validator php 中,这个问题最后提到了这个,

$template = str_replace('{price}',

【问题讨论】:

    标签: php


    【解决方案1】:

    您在行尾缺少括号 )

    【讨论】:

    • 我也尝试这样做: $template = str_replace('{price}', number_format(($row['price'], 2, '.', '') $template));还是一样的问题
    • 请检查我的更新
    猜你喜欢
    • 1970-01-01
    • 2011-09-14
    • 1970-01-01
    • 2018-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-12
    相关资源
    最近更新 更多