将小写"i"转换为大写"İ"时会出现不同的字符(Wordpress Gravity)



我正在使用一个函数.php代码,在发布"输入";Wordpress重力表单插件的数据。

add_action('gform_pre_submission_1', 'capitalize_fields_1');
function capitalize_fields_1($form){
// add all the field IDs you want to capitalize, to this array
$fields_to_cap = array('input_1');
foreach ($fields_to_cap as $each) {
// for each field, convert the submitted value to uppercase and assign back to the POST variable
// the rgpost function strips slashes

$_POST[$each] = strtoupper(rgpost($each));
}
// return the form, even though we did not modify it
return $form;
}

然而,我使用的是土耳其语,有一个字符不属于UTF-8。小写字母";i〃;变成字母";我"转换时。这两个字的意思各不相同。我想转换小写字母";i〃;变成字母";我";。

我为这个过程找到了一个php代码,但我无法将其改编为function.php文件。

function mb_strtoupper_tr($metin){
$metin=str_replace('i', 'İ', $metin);

有人能帮助我如何调整这一点或实现更有效的方法吗?

add_action('gform_pre_submission_1', 'capitalize_fields_1');
function capitalize_fields_1($form){
// add all the field IDs you want to capitalize, to this array
$fields_to_cap = array('input_1');
foreach ($fields_to_cap as $each) {
// for each field, convert the submitted value to uppercase and assign back to the POST variable
// the rgpost function strips slashes

$_POST[$each] = strtoupper(str_replace('i', 'İ', rgpost($each)));
}
// return the form, even though we did not modify it
return $form;
}

最新更新