How to deal with the format of the amount, front-end and PHP such as 10.55 yuan, in order to unify the display of the website, should we use number_format in PHP to convert it to display it on the page, or do we say PHP only uses floatval, it is processed when the page is displayed. In JS, how to determine the format of 1, 00.00 if the page is POST to how to handle the amount, front-end and PHP
For example, 10.55 RMB. Should I use number_format in PHP to display all the websites in a unified manner and then display them on the page?
In other words, PHP only uses floatval to display the page.
In JS, how to judge the form of 1, 00.00
If the format of the page POST to PHP is 1, 00.00, what should we do.
Hope to give some suggestions on how to be more unified and secure
------ Best solution --------------------
Written in public functions
Where to call data
Where can I format it?
Same as js
------ Other solutions --------------------
Currency replacement.
1. clarify the ideas,
For regular expressions, currency replacement is to find the/d at the end of the distance or separated by/d {3} +.
So at the beginning, it is (/d )(? = (/D {3}) + ($
------ Other solutions --------------------
About POST submission
You can hide real data in the form.
You can also process it on the submit page.
We strongly recommend that you format the verification on the server.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.