php将字符串转为小数的方法:1、使用number_format()函数,语法“number_format($str,小数位数值)”;2、利用sprintf()函数格式化字符串,语法“sprintf("%.小数位数值f"