Textarea空格 [英] Textarea whitespaces
本文介绍了Textarea空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HTML:
< textarea class ='form-control input-lg'name ='stout'style ='width:100%; min -height:200px; resize:none; >
<?php $ a = $ functie-> _getFileContent('../ content / stout.txt','j');
echo $ bewerking-> _extraInfoInput($ a);?>
< / textarea>
功能:
public function _extraInfoInput($ a){
$ a = preg_replace('/ /','',$ a);
返回$ a;
}
public function _getFileContent($ file,$ uitzondering){
$ content = file_get_contents($ file);
if($ content!=''){
if($ uitzondering ==''){
$ a = $ content。'< br />';
}
else {
$ a = $ content;
}
返回$ a;
}
}
解决方案
你的html中有空格。更改为
< textarea class ='form-control input -lg'name ='stout'style ='width: 100%; min-height:200px; resize:none;'><! - no whitespace here - ><?php $ a = $ functie-> _getFileContent('../ content / stout。 txt','j');
echo $ bewerking-> _extraInfoInput($ a);?><! - 或here - >< / textarea>
Every time I update my form textarea the form addes a white space. This is a probleem because I use the textarea input to create a new array element with every new line that the user uses.
HTML:
<textarea class='form-control input-lg' name='stout' style='width:100%;min-height:200px;resize: none; '>
<?php $a = $functie- >_getFileContent('../content/stout.txt', 'j');
echo $bewerking->_extraInfoInput($a);?>
</textarea>
Functions:
public function _extraInfoInput($a){
$a = preg_replace('/ /', '', $a);
return $a;
}
public function _getFileContent($file,$uitzondering){
$content = file_get_contents($file);
if($content != ''){
if($uitzondering == ''){
$a = $content.'<br/>';
}
else{
$a = $content;
}
return $a;
}
}
解决方案
You have whitespace in your html. Change to this
<textarea class='form-control input-lg' name='stout' style='width:100%;min-height:200px;resize: none;'><!-- no whitespace here--><?php $a = $functie- >_getFileContent('../content/stout.txt', 'j');
echo $bewerking->_extraInfoInput($a);?><!-- or here --></textarea>
这篇关于Textarea空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文