Cakephp2.0正在从从mysql接收的数据中删除额外的空间


Cakephp2.0 is removing extra spaces from data received from mysql

我有信息保存在mysql数据库

就是输入
$name = 'This is the sample                      data'

实际得到不需要的输出

 $name = 'This is the sample data' 
所需输出

$name = 'This is the sample                      data'

从数据库检索时,我可以看到使用PR()也很好但是当echo $name时,它会删除不需要的额外空格。

浏览器不支持html中的空白。这意味着两个或更多的空间总是被压缩成一个。如果你真的需要按原样显示文本,使用<pre>标签:

<pre>This is the sample                      data</pre>

这告诉你的浏览器文本是预格式化的。