php - number_format 遇到的格式不正确的数值
问题描述
使用数字格式更新发票中的值时,我收到了格式不正确的数值错误消息。
$amount = number_format($_POST['amount'], 2);
解决方案
我已更新 JavaScript 以使用 isNaN() 验证金额
var amount = $('#invoiceAmount').val();
if(isNaN(amount)){
alert ('Please enter in the valid amount.');
} else
// post values by AJAX
}
推荐阅读
- laravel - 错误:未定义的变量:视图中的数据(foreach)
- python - 在第一次请求/解析之前在蜘蛛中抓取返回项目
- flutter - 如何删除TextField下方的下划线?
- c - 在一种方法中使用两个信号量
- java - 为什么我的字符串比较代码不起作用?
- javascript - 尝试使 while 循环的范围大于 10 时出错
- logstash - Logstash 多行输入适用于本地但不适用于 EC2 实例
- javascript - 在 reducer 中状态更改后,组件不会重新渲染
- python-3.x - 移动文件夹中所有文件的逻辑错误
- java - 处理给定输入文件和我的查询文件中常见的单词