Database written directly using the Phpexcel import string
There are spaces behind what you don't know.
trim cannot be removed.
Reply content:
Database written directly using the Phpexcel import string
There are spaces behind what you don't know.
trim cannot be removed.
Preg_replace ("/(\s|\ \;| | \XC2\XA0)/"," ", $content);
Chinese space There are several kinds of: there is no simple way to solve the problem, such as the half-width of full-width space, such as the paragraph will be displayed as blank, and then let people misunderstand it is a space, so remove the space before you must first confirm that their own is not a space, I analyze the following two solutions.
(1)/[\s|] +/This can be, note | The following is the full-width space
(2) The regular replacement in MB can also try
Also note that when using Unicode, plus the regular expression descriptor U
But because there are a lot of spaces in Chinese, such as the one I encountered below, it's Unicode encoding c2a0, using the following expression will solve the problem.
$new [' content '] = preg_replace ('/^[(\xc2\xa0) |\s]+/', ' ', $new [' content ']);
Here is a detail: \xc2a0 is originally a Unicode character, but can not match multiple, can only replace one, "here may be because of the reason of the byte" then suddenly found such a way to solve the problem, in addition to avoid, Chinese space and English space mixed situation, followed by a \ S to clear.