简体   繁体   English

Cakephp2.0正在从MySQL接收的数据中删除多余的空间

[英]Cakephp2.0 is removing extra spaces from data received from mysql

I have information saved in mysql database 我已将信息保存在mysql数据库中

Input given 输入给定

$name = 'This is the sample                      data'

Actually getting output which is not required 实际获得不需要的输出

 $name = 'This is the sample data' 

Desired Output 期望的输出

$name = 'This is the sample                      data'

while retrieving from database I can see using PR() which is also fine but while echo $name it removes extra spaces which is not required. 从数据库中检索时,我可以看到使用PR()也很好,但是在echo $name它会删除不需要的多余空间。

Browsers collapse white space in html. 浏览器折叠html中的空白。 That means two or more spaces are always collapsed to one. 这意味着两个或更多的空间总是折叠为一个。 If you really need to display the text as is, use the <pre> tag: 如果确实需要按原样显示文本,请使用<pre>标记:

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

This tells your browser that the text is preformatted. 这告诉您的浏览器文本是预先格式化的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM