【发布时间】:2014-09-16 13:07:10
【问题描述】:
如何防止 php 从 textarea 第一行的开头删除空格。每次我提交表单时,withespace 都会被删除...即使我将其替换为 nbsp;
我正在使用的代码:
PHP
if(isset($_POST['btn_cel'])){
$text = trim($_POST['cel']);
$text = explode("\n", $text);
foreach($texto as $line){
echo str_replace(' ',' ',$line);
}
}
输入
1234 5678
abcdefghif
输出
1234 5678
abcdefghif
【问题讨论】:
-
删除 $text = trim($_POST['cel']);这一行
-
发布您的 html 文本区域
标签: php html submit whitespace