php解决input输入多个空格只显示一个的问题

这里简单的介绍了关于PHP解决input输入多个空格只显示一个的问题,我们利用了chr(32)来替换成html空格符,实例代码如下:

  1. <body> 
  2. <form id=form1 name=form1 method=post action=
  3.   <label for=textfield></label> 
  4.   <input type=text name=txt id=txt /> 
  5.   <input type=submit name=button id=button value=提交 /> 
  6. </form> 
  7. </body> 
  8. </html> 
  9. <? 
  10. if$_POST ) 
  11.  $txt = $_POST['txt']; 
  12.  echo $txt.'<br />'
  13.  echo str_replace(chr(32),'&nbsp;',$txt); 
  14. ?> 

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...