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

查看所有标签

How to Build a Billion Dollar App

How to Build a Billion Dollar App

George Berkowski / Little, Brown Book Group / 2015-4-1 / USD 24.95

Apps have changed the way we communicate, shop, play, interact and travel and their phenomenal popularity has presented possibly the biggest business opportunity in history. In How to Build a Billi......一起来看看 《How to Build a Billion Dollar App》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具