0

when users upload some files, the price tag for some files comes out as 2.97211$ instead of 2.97$ which leads to a

ERROR: #10401: Transaction refused because of an invalid argument. See additional error messages for details. [Order total is invalid.]

error when they try to check out with the payment gateway.

Here is the code that is giving the problem

$filesize = filesize($file) * .0009765625; // bytes to KB

I have tried changing the .0009765625 variable to many different values .1002345625 .2342335622 etc etc to no avail.

I've also tried changing this part of the code.

else{return round($filesize, 2);}

to else{return round($filesize 0.02, 2);} which inflates the price to 400.52$ which makes the item unpayable.

How do i force the price to remain at 0.00$ instead of 0.00000$?

4

1 回答 1

-1

使用 php number_format 函数

$formatted = number_format(filesize($fileName), 2, '.', '');
于 2013-11-10T07:24:54.393 回答