str_replace(find,replace,string,count)
find:需要替换的值
replace:将要替换的值,
string:被替换的字符串
count:同级替换的次数

如果需要把数据库中存储的带回车以及空格的文章,按照其原来的样式显示在html中,可以使用此函数,

function htmtocode( $content ) {
    $content = str_replace( '\n','<br/>',str_replace(' ','&nbsp;' ,$content) );
    return $content;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
  • 2021-05-27
  • 2021-11-20
  • 2021-07-19
  • 2022-12-23
相关资源
相似解决方案