Как разрешить арабские символы в URL - PullRequest
0 голосов
/ 24 октября 2019

У моего URL есть арабские символы, такие как http://localhost/Mypro/ar/flights/رخيص-هواء-تذاكر-البحرين-إلى-مومباي-بوم-باه, и я переправил это в метод. Когда я загружаю этот URL, у меня появляется ошибка:

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404
localhost
Apache/2.4.39 (Win64) OpenSSL/1.1.1b PHP/7.2.18. 

Может ли кто-нибудь помочь мне решить эту проблему.

config \ route.php

$path = urlencode('الرخيصة من الجو تذاكر - (: وجدت) -to - (: أي) - (: أي) - (: وجدت)');
$route['^(en|ar)/'.$path] = "Seo/viewCities";

config \ config.php

$config['permitted_uri_chars'] .= '%D8%A2%D8%A7%D8%A8%D9%BE%D8%AA%D8%AB%D8%AC%DA%86%D8%AD%D8%AE%D8%AF%D8%B0%D8%B1%D8%B2%D8%B3%D8%B4%D8%B5%D8%B6%D8%B7%D8%B8%D8%B9%D8%BA%D9%81%D9%82%DA%A9%DA%AF%D9%84%D9%85%D9%86%D9%88%D9%87%DB%8C%D9%8A%DB%B1%DB%B2%DB%B3%DB%B4%DB%B5%DB%B6%DB%B7%DB%B8%DB%B9%DB%B0';

system \ core \ uri.php

public function filter_uri(&$str)
    {
        if (!preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $str))
        {
            show_error('The URI you submitted has disallowed characters.', 400);
        }
    }

1 Ответ

0 голосов
/ 04 ноября 2019

Этот фрагмент кода, возможно, может помочь

    $string ="العربی (العربی";
    $string=str_replace(")","",$string);
//and u can use other str_replace

    $this->load->helper('text');
    $til = url_title(convert_accented_characters($string), 'dash', true);

// $, пока ваш слаг для URL

эта работа для меня:)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...