Simple way? Use strip_tags()
:
$str = strip_tags($input);
You can also use filter_var()
for that:
$str = filter_var($input, FILTER_SANITIZE_STRING);
The advantage of filter_var()
is that you can control the behaviour by, for example, stripping or encoding low and high characters.
Here is a list of sanitizing filters.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…