FILTER_VALIDATE_URL 过滤器在验证非 ASCII 网址时似乎有一些问题:
The FILTER_VALIDATE_URL filter seems to have some trouble validating non-ASCII URLs:
var_dump(filter_var('http://pt.wikipedia.org/wiki/', FILTER_VALIDATE_URL)); // http://pt.wikipedia.org/wiki/
var_dump(filter_var('http://pt.wikipedia.org/wiki/Guimarães', FILTER_VALIDATE_URL)); // false
为什么最后一个 URL 没有正确验证?可能的解决方法是什么?运行 PHP 5.3.0.
Why isn't the last URL correctly validated? And what are the possible workarounds? Running PHP 5.3.0.
我还想知道在哪里可以找到 FILTER_VALIDATE_URL 验证过滤器的源代码.
I'd also like to know where I can find the source code of the FILTER_VALIDATE_URL validation filter.
解析从这里开始:
http://svn.php.net/viewvc/php/php-src/trunk/ext/filter/logical_filters.c?view=markup
实际上是在/trunk/ext/standard/url.c 中完成的
and is actually done in /trunk/ext/standard/url.c
乍一看,我看不到任何有意拒绝非 ASCII 字符的内容,因此可能只是缺少 unicode 支持.PHP 不擅长处理任何地方的非 ASCII 字符.:(
At a first glance I can't see anything that purposely rejects non-ASCII characters, so it's probably just lack of unicode support. PHP is not good in handling non-ASCII characters anywhere. :(
这篇关于PHP filter_var() - FILTER_VALIDATE_URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
以编程方式将可下载文件添加到 Woocommerce 产品Add programmatically a downloadable file to Woocommerce products(以编程方式将可下载文件添加到 Woocommerce 产品)
获取今天 Woocommerce 中每种产品的总订单数Get today#39;s total orders count for each product in Woocommerce(获取今天 Woocommerce 中每种产品的总订单数)
在 WooCommerce 和电话字段验证问题中添加自定义注Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和电话字段验证问题中添加自定义注册字段
在 Woocommerce 简单产品中添加一个将更改价格的选Add a select field that will change price in Woocommerce simple products(在 Woocommerce 简单产品中添加一个将更改价格的选择字段)
在 WooCommerce 3 中将自定义列添加到管理产品列表Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中将自定义列添加到管理产品列表)
自定义结帐“下订单"按钮输出htmlCustomizing checkout quot;Place Orderquot; button output html(自定义结帐“下订单按钮输出html)