PHP FILTER_SANITIZE_URL 过滤器

PHP 教程 · 2019-01-25 20:56:39

定义和用法

FILTER_SANITIZE_URL 过滤器删除字符串中所有非法的 URL 字符。

该过滤器允许所有的字母、数字以及 $-_.+!*'(),{}|\^~[]`"><#%;/?:@&=

  • Name: "url"
  • ID-number: 518

实例


<?php
$var="http://www.w3cschooåøl.cøc";

var_dump(filter_var($var, FILTER_SANITIZE_URL));
?>

代码的输出如下所示:


string(24) "http://www.w3cschool.cc"


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

查看所有标签

Persuasive Technology

Persuasive Technology

B.J. Fogg / Morgan Kaufmann / 2002-12 / USD 39.95

Can computers change what you think and do? Can they motivate you to stop smoking, persuade you to buy insurance, or convince you to join the Army? "Yes, they can," says Dr. B.J. Fogg, directo......一起来看看 《Persuasive Technology》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

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

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具