例子
代码如下 | 复制代码 |
function Bing_string_cleanr( $string ){ $string = trim( $string ); $string = strip_tags( $string ); $string = htmlspecialchars( $string, ENT_QUOTES, 'UTF-8' ); $string = str_replace( "n", "", $string ); $string = trim( $string ); return $string; } |
使用方法:
代码如下 | 复制代码 |
echo Bing_string_cleanr( '内 容 <br> <html> asdfeiuonsdfje' ); |
删除空白
代码如下 | 复制代码 |
<?php $str = " This line containstliberal rn use of whitespace.nn"; // First remove the leading/trailing whitespace // Now remove any doubled-up whitespace // Finally, replace any non-space whitespace, with a space // Echo out: 'This line contains liberal use of whitespace.' |
时间: 2024-10-14 20:39:49