网址形成设置语言是格鲁吉亚语

时间:2014-07-08 20:03:49

标签: php

这里是url形成代码,我想要seo friendli网址,但我的语言是格鲁吉亚语,我的网址是格鲁吉亚语,我不会转换格鲁吉亚语sumbols englis sumbols

function qa_q_request($ questionid,$ title) / *     返回问题$ questionid的Q2A请求,并根据$ title对其进行搜索引擎友好     如果有必要,通过删除通常不太有意义的较短词来缩短。 * /     {         if(qa_to_override( FUNCTION )){$ args = func_get_args(); return qa_call_override( FUNCTION ,$ args); }

    require_once QA_INCLUDE_DIR.'king-app-options.php';
    require_once QA_INCLUDE_DIR.'king-util-string.php';

    $title=qa_block_words_replace($title, qa_get_block_words_preg());

    $words=qa_string_to_words($title, true, false, false);

    $wordlength=array();
    foreach ($words as $index => $word)
        $wordlength[$index]=qa_strlen($word);

    $remaining=qa_opt('q_urls_title_length');

    if (array_sum($wordlength)>$remaining) {
        arsort($wordlength, SORT_NUMERIC); // sort with longest words first

        foreach ($wordlength as $index => $length) {
            if ($remaining>0)
                $remaining-=$length;
            else
                unset($words[$index]);
        }
    }

    $title=implode('-', $words);
    if (qa_opt('q_urls_remove_accents'))
        $title=qa_string_remove_accents($title);

    return (int)$questionid.'/'.$title;
}

1 个答案:

答案 0 :(得分:0)

页面标题的URL友好版本称为slug。这是一个将字符串转换为slug的脚本。

https://code.google.com/p/php-slugs/

如果您使用的是CMS,那么它可能会内置您可以使用的功能。