In the development process, you will often encounter the need to give someone an input box, and then someone input some ID, or keywords, such as WordPress's background of the label input box:
This is just to judge the English state of the comma, if someone accidentally entered the Chinese state of the comma how to do? What about the decimal point?
So I wrote an expression with a regular, and replaced it with a comma with a blank line break.
Replace the submitted ID with a white space line break with a comma, and then use the Explode function to toggle the array.
Copy Code code as follows:
$ids =$_post["ID"];
$id = preg_replace ("/\ n) | ( \s) | (t) | (\')| (')| (,)/", ', ', $ids);
$topicids = Explode (",", $tids);
This is the addition of a decimal point filter.
Copy Code code as follows:
$ids = preg_replace ("/\ n) | ( \s) | (t) | (\')| (')| (,) | (\.) /", ', ', $ids);
OK, after this treatment, there will be no problem.
Hint: In fact, small knitting feel with JS before submitting to deal with this problem, is a better choice.