@idddddy

Как изменить кириллические символы в url?

Есть функция:
<?php
function smarty_function_url($params, &$smarty)
{
    global $config;
    $base       = $params['base'];
    $strip      = $params['strip'];
    $arg        = ( isset($params['value']) ) ? $params['value'] : NULL;
    $query      = NULL;
    
    foreach ( $_GET as $key => $value ) {
        if ( $key != $strip ) {
			if ( $key != 'page' )
            $query .= '&' .$key. '=' .$value;
        }
    } 
    if ( $arg ) {
        $query .= '&' .$strip. '=' .$arg;
    }
    
    if ( $query ) {
        $query = '?' .substr($query, 1);
    }
    return str_replace('&', '&', $config['RELATIVE']. '/' .$base . htmlspecialchars($query, ENT_QUOTES, 'UTF-8'));
}
?>

как внедрить замену кириллицы:
$tr = array(
                          "Ґ"=>"G","Ё"=>"YO","Є"=>"E","Ї"=>"YI","І"=>"I",
                             "і"=>"i","ґ"=>"g","ё"=>"yo","№"=>"#","є"=>"e",
                                "ї"=>"yi","А"=>"A","Б"=>"B","В"=>"V","Г"=>"G",
                                   "Д"=>"D","Е"=>"E","Ж"=>"ZH","З"=>"Z","И"=>"I",
                                      "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N",
                                         "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T",
                                            "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH",
                                               "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"'","Ы"=>"YI","Ь"=>"",
                                                  "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b",
                                                     "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"zh",
                                                        "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l",
                                                           "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r",
                                                              "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h",
                                                                 "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"'",
                                                                    "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya"
                                                                      );
  • Вопрос задан
  • 49 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы