如何使用PHP添加和删除行距?

如何使用PHP添加和删除行距?,php,Php,每次我提交textarea时,它都会在textarea框的顶部自动添加行距。如何以及在何处添加仅使用回车键(enter)输入新行的编码 如果不知道comments.php中到底发生了什么,您必须执行以下操作: <?php ob_start(); include 'comments.php'; $buffer = trim(ob_get_clean()); ?> <textarea input type="text" name="Comments" style="height

每次我提交textarea时,它都会在textarea框的顶部自动添加行距。如何以及在何处添加仅使用回车键(enter)输入新行的编码




如果不知道comments.php中到底发生了什么,您必须执行以下操作:

<?php
ob_start();
include 'comments.php';
$buffer = trim(ob_get_clean());
?>
<textarea input type="text" name="Comments" style="height:100%;width:100%"
cols="100%" rows="10" ><?php echo htmlspecialchars($buffer); ?></textarea>


trim()函数去除了字符串开头和结尾的空格。

您是否查看了
comments.php
中的内容?仅仅因为这段代码没有额外的换行符,并不意味着你包含的文件也没有…@user2714558太好了!您介意单击答案旁边的绿色复选标记将其标记为已接受吗?
<?php
ob_start();
include 'comments.php';
$buffer = trim(ob_get_clean());
?>
<textarea input type="text" name="Comments" style="height:100%;width:100%"
cols="100%" rows="10" ><?php echo htmlspecialchars($buffer); ?></textarea>