当前位置: 首页>>代码示例>>PHP>>正文


PHP Utf8::utf8_decode方法代码示例

本文整理汇总了PHP中Patchwork\Utf8::utf8_decode方法的典型用法代码示例。如果您正苦于以下问题:PHP Utf8::utf8_decode方法的具体用法?PHP Utf8::utf8_decode怎么用?PHP Utf8::utf8_decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patchwork\Utf8的用法示例。


在下文中一共展示了Utf8::utf8_decode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: api_utf8_decode

/**
 * Converts a given string from UTF-8 encoding to a specified encoding.
 * @param string $string                    The string being converted.
 * @param string $to_encoding (optional)    The encoding that $string is being converted to. If it is omited, the platform character set is assumed.
 * @return string                            Returns the converted string.
 * This function is aimed at replacing the function utf8_decode() for human-language strings.
 * @link http://php.net/manual/en/function.utf8-decode
 */
function api_utf8_decode($string, $to_encoding = null)
{
    return u::utf8_decode($string);
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:12,代码来源:internationalization.lib.php

示例2: filterRequestUri

 static function filterRequestUri()
 {
     // Ensures the URL is well formed UTF-8
     // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL
     if (isset($_SERVER['REQUEST_URI']) && !preg_match('//u', urldecode($a = $_SERVER['REQUEST_URI']))) {
         if ($a === u::utf8_decode($a)) {
             $a = preg_replace_callback('/(?:%[89A-F][0-9A-F])+/i', function ($m) {
                 return urlencode(u::utf8_encode(urldecode($m[0])));
             }, $a);
         } else {
             $a = '/';
         }
         header('HTTP/1.1 301 Moved Permanently');
         header('Location: ' . $a);
         exit;
     }
 }
开发者ID:pyjac,项目名称:BSSB,代码行数:17,代码来源:Bootup.php


注:本文中的Patchwork\Utf8::utf8_decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。