PHP FILTER_SANITIZE_ENCODED 过滤器

PHP 教程 · 2019-01-25 20:11:55

定义和用法

FILTER_SANITIZE_ENCODED 过滤器去除或 URL 编码不需要的字符。

该过滤器与 urlencode() 函数很类似。

  • Name: "encoded"
  • ID-number: 514

可能的标志:

  • FILTER_FLAG_STRIP_LOW - 去除 ASCII 值在 32 以下的字符
  • FILTER_FLAG_STRIP_HIGH - 去除 ASCII 值在 32 以上的字符
  • FILTER_FLAG_ENCODE_LOW - 编码 ASCII 值在 32 以下的字符
  • FILTER_FLAG_ENCODE_HIGH - 编码 ASCII 值在 32 以上的字符

实例


<?php
$url="http://www.codercto.com";
var_dump(filter_var($url,FILTER_SANITIZE_ENCODED));
?>

代码的输出如下所示:


string(29) "http%3A%2F%2Fwww.codercto.com"


点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Designing with Web Standards (2nd Edition)

Designing with Web Standards (2nd Edition)

Jeffrey Zeldman / Peachpit Press / 2006-07-06 / USD 44.99

Best-selling author, designer, and web standards evangelist Jeffrey Zeldman has updated his classic, industry-shaking guidebook. This new edition--now in full color--covers improvements in best prac......一起来看看 《Designing with Web Standards (2nd Edition)》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

html转js在线工具
html转js在线工具

html转js在线工具