php mysql decimal 多余的0 解决方案

 

select id,(0+cast(price as decimal(10,2))) as price,title from goods where id=1 

以上mysql的方法 但是PHP读取出来有时候还是带0

 

所以最靠谱的方法 数据库读取出来 用PHP处理下

 

echo floatval(0.200);
exit();

读取出来的就是0.2

 

相关文章:

  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2021-12-18
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案