我正在从数据库中检索数据,其中一些值给了我一些问题。例如,有时当我在屏幕上打印出来时,它会这样打印:
Something here
Something else here
,但应该是:
Something here Something else here
我查了一下,显然它显示为:
Something here _x000B_ Something else here
在数据库中,我不允许更改它。我甚至不确定x000B应该是什么,但我确定这就是为什么我有问题。我尝试过像这样删除空格:
$test = str_replace(' ', '', $string);
它去掉了空格,但仍然是这样:
Somethinghere
Somethingelsehere
尝试替换换行符和回车符。
str_replace("'n", "", $string);
str_replace("'r", "", $string);
注意双引号的使用。
你提到你不确定它应该是什么。不管怎样,这是一个垂直标签。en.wikipedia.org/wiki/Whitespace_character
则Exn的回复:@rrtx2000谢谢!这帮我解决了问题。:)我使用了这个:str_replace("'v", " ", $string);你应该得到最好的答案。
试试这个:我已经添加了大部分的可能性。
str_replace(array("'n", "'r", "'t", "'f", "", "_x000B_"), "", $string);