php mysql decimal 多余的0 解决方案

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

原文地址:https://www.cnblogs.com/newmiracle/p/12217391.html