Home  >  Article  >  Backend Development  >  PHP solves the problem of inputting multiple spaces and only displaying one_PHP tutorial

PHP solves the problem of inputting multiple spaces and only displaying one_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:55:081050browse

Here is a brief introduction to how PHP solves the problem of inputting multiple spaces and only displaying one. We use chr(32) to replace the html space character. Friends in need can refer to it.

 代码如下 复制代码


 
 
 



if( $_POST )
{
$txt = $_POST['txt'];
echo $txt.'
';
 echo str_replace(chr(32),' ',$txt);
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632265.htmlTechArticleHere is a brief introduction to how PHP solves the problem of inputting multiple spaces and only displaying one. We use chr( 32) to replace it with html space characters. Friends in need can refer to it. Code...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn