Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 用另一个字母替换印地语中的特定字母_Php_Html_Codeigniter_Hindi - Fatal编程技术网

Php 用另一个字母替换印地语中的特定字母

Php 用另一个字母替换印地语中的特定字母,php,html,codeigniter,hindi,Php,Html,Codeigniter,Hindi,我使用印地语向用户显示数据。但我想替换用户看到的所有单词中的一个特定字母。我想替换 "ख" 有“ष“ "खा“与”षा“和。我想在插入数据库时替换它。 表示如果用户类型为“ख在任何形式中,它都应作为ष“在数据库中。所以任何人对此都有想法吗?”您可以使用 我创建了自己的库文件stringhandler.php <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class stringhandle

我使用印地语向用户显示数据。但我想替换用户看到的所有单词中的一个特定字母。我想替换
"ख" 有“ष“
"खा“与”षा“
和。我想在插入数据库时替换它。 表示如果用户类型为“ख在任何形式中,它都应作为ष“在数据库中。所以任何人对此都有想法吗?”

您可以使用


我创建了自己的库文件stringhandler.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class stringhandler {

 function normalize_str($str)
{
$invalid = array('ख'=>'ष', 'खा'=>' षा', 'खि'=>'षि', 'खी'=>'षी', 'खु'=>'षु', 'खू'=>'षू',
'खे'=>'षे', 'खै'=>'षै', 'खो'=>'षो', 'खौ'=>' षौ', 'खं'=>' षं', 'खः'=>'षः');

$str = str_replace(array_keys($invalid), array_values($invalid), $str);

return $str;
}
}

希望这能帮助一些人。

我不懂印地语和语言结构,但你可以查阅php手册并尝试使用“str_replace”函数。
define('CHARSET','UTF-8');
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class stringhandler {

 function normalize_str($str)
{
$invalid = array('ख'=>'ष', 'खा'=>' षा', 'खि'=>'षि', 'खी'=>'षी', 'खु'=>'षु', 'खू'=>'षू',
'खे'=>'षे', 'खै'=>'षै', 'खो'=>'षो', 'खौ'=>' षौ', 'खं'=>' षं', 'खः'=>'षः');

$str = str_replace(array_keys($invalid), array_values($invalid), $str);

return $str;
}
}
'fname'=>$this->stringhandler->normalize_str($this->input->post('fname')),
'fathername'=>$this->stringhandler->normalize_str($this->input->post('fathername')),