简体   繁体   English

MySQL的textarea中的前导空格

[英]Leading spaces in textarea from MySQL

I'm retrieving data from a mysql table column and placing it into a textarea. 我正在从mysql表列中检索数据,并将其放入textarea中。

When I do this, I get a huge section of leading spaces for only the first row of data. 当我这样做时,我得到了很大一部分前导空间,仅用于第一行数据。 I've tried using mysql TRIM and PHP TRIM functions, and neither of them seem to work. 我尝试使用mysql TRIM和PHP TRIM函数,但它们似乎都不起作用。 Additionally, when I query the database directly, there are no leading spaces: 另外,当我直接查询数据库时,没有前导空格:

+-----------------+
| article_content |
+-----------------+
| # Test
        |
+-----------------+

Has anyone had this issue before? 有人遇到过这个问题吗?

在此处输入图片说明

This happens more often than not, but I try for several hours to fix something and can't figure it out, and then I post here on stack overflow, and then the answer hits me. 这种情况多半会发生,但是我尝试了几个小时来修复某些问题却无法解决,然后我在此处发布了堆栈溢出问题,然后答案就传给了我。

The issue was with my HTML section. 问题出在我的HTML部分。 I forgot that textarea will interpret all spaces and tabs, etc, so when I indented my code that is inside some PHP code, it interpreted it, and inserted the spaces/tabs. 我忘记了textarea会解释所有空格和制表符,等等,因此当我缩进某些PHP代码中的代码时,它会对其进行解释,并插入空格/制表符。

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

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