我将处理时间作为float(4,4)存储在
MySQL数据库中.
$start_time = microtime( TRUE );
// things happen in my script
$end_time = microtime( TRUE );
$process_time = $end_time - $start_time;
// insert $process time into MysqL table
$process_time总是在输出到命令行时正确显示,但是如果它的值大于1,它将以MysqL存储为.9999.
是什么赋予了?
float(4,4)表示总共4位数,其中4位在小数点后面.
所以你必须改为10,4例如
MysqL permits a nonstandard Syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here,“(M,D)” means than values can be stored with up to M digits in total,of which D digits may be after the decimal point.