Home > Backend Development > PHP Tutorial > Enhanced version of htmlspecialchars function

Enhanced version of htmlspecialchars function

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 09:07:17
Original
869 people have browsed it
  1. //取消html代码
  2. function shtmlspecialchars($string) {
  3. if(is_array($string)) {
  4. foreach($string as $key => $val) {
  5. $string[$key] = shtmlspecialchars($val);
  6. }
  7. } else {
  8. $string = preg_replace(‘/&((#(\d{3,5}|x[a-fA-F0-9]{4})|[a-zA-Z][a-z0-9]{2,5});)/’, ‘&\\1′,
  9. str_replace(array(‘&’, ‘”‘, ‘<’, ‘>’), array(‘&’, ‘"’, ‘<’, ‘>’), $string));
  10. }
  11. return $string;
  12. }
  13. ?>
复制代码


source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template