gpt4 book ai didi

php - strtr 函数不起作用

转载 作者:可可西里 更新时间:2023-11-01 00:48:59 30 4
gpt4 key购买 nike

你好吗。希望很好...

我遇到了以下代码的问题。 strtr 函数不工作。它不输出任何东西...

if ($translate == "DrChatrikWeb") {
$convertarray = array(
"~" => "~",
"!" => "!",
"@" => "@",
"#" => "#",
"$" => "$",
"%" => "%",
"^" => "^",
"&" => "&",
"*" => "*",
"(" => "(",
")" => ")",
"_" => "_",
"+" => "+",
"`" => "`",
"1" => "1",
"2" => "2",
"3" => "3",
"4" => "4",
"5" => "5",
"6" => "6",
"7" => "7",
"8" => "8",
"9" => "9",
"0" => "0",
"-" => "_",
"=" => "=",
"Q" => "ਥ",
"W" => "ੱ",
"E" => "ਓ",
"R" => "੍ਰ",
"T" => "ਠ",
"Y" => "ੈ",
"U" => "ੂ",
"I" => "ੀ",
"O" => "ੌ",
"P" => "ਫ",
"{" => "{",
"}" => "}",
"|" => "।",
"q" => "ਤ",
"w" => "ੱ",
"e" => "ੲ",
"r" => "ਰ",
"t" => "ਟ",
"y" => "ੇ",
"u" => "ੁ",
"i" => "ਿ",
"o" => "ੋ",
"p" => "ਪ",
"[" => ".",
"]" => "॥",
"\\" => "\\",
"A" => "ੳ",
"S" => "ੰ",
"D" => "ਧ",
"F" => "ਾਂ",
"G" => "ਘ",
"H" => "੍ਹ",
"J" => "ਝ",
"K" => "ਖ",
"L" => "਼",
":" => ":",
"\"" => "\"",
"a" => "ਅ",
"s" => "ਸ",
"d" => "ਦ",
"f" => "ਾ",
"g" => "ਗ",
"h" => "ਹ",
"j" => "ਜ",
"k" => "ਕ",
"l" => "ਲ",
";" => ";",
"'" => "'",
"Z" => "ਢ",
"X" => "ਯ",
"C" => "ਛ",
"V" => "ੜ",
"B" => "ਭ",
"N" => "ਂ",
"M" => "ੰ",
"" => ",",
">" => ">",
"?" => "?",
"z" => "ਡ",
"x" => "ਣ",
"c" => "ਚ",
"v" => "ਵ",
"b" => "ਬ",
"n" => "ਨ",
"m" => "ਮ",
"" => ",",
"." => "।",
"/" => "/",
"¡" => "ੴ",
"«" => "॥",
"¬" => "#",
"R" => "੍ਰ",
"•" => "•",
"»" => "।",
"Ã" => "ੴ",
"Å" => "ੴ",
"Ç" => "☬",
"È" => "ਸ਼",
"É" => "ਖ਼",
"Ê" => "ਗ਼",
"Ë" => "ਜ਼",
"Ì" => "ਫ਼",
"Î" => "੍ਯ",
"Ñ" => "#",
"Ò" => "॥",
"Ü" => "ਲ਼",
"ñ" => "੧",
"ò" => "੨",
"ó" => "੩",
"ô" => "੪",
"õ" => "੫",
"ö" => "੬",
"÷" => "੭",
"ø" => "੮",
"ù" => "੯",
"ú" => "੦",
"ƒ" => "ਨੂੰ",
"“" => "“",
"”" => "”",
"Í" => "੍ਵ",
);
$string = strtr($texttoreplace, $convertarray);
echo $string;
}

数组是旁遮普语,即印度语...

此代码运行完美...

$repp = array(
"<br />" => " <br> ",
" ," => " <punc>,</punc> ",
" ." => " <punc>.</punc> ",
" /" => " <punc>/</punc> ",
" \\" => " <punc>\\</punc> ",
" !" => " <punc>!</punc> ",
" ?" => " <punc>?</punc> ",
" :" => " <punc>:</punc> ",
" ;" => " <punc>;</punc> ",
" \"" => " <punc>\"</punc> ",
" '" => " <punc>'</punc> ",
" (" => " <punc>(</punc> ",
" )" => " <punc>)</punc> ",
" {" => " <punc>{</punc> ",
" }" => " <punc>}</punc> ",
" <" => " <punc><</punc> ",
" >" => " <punc>></punc> ",
" [" => " <punc>[</punc> ",
" ]" => " <punc>]</punc> ",
" &" => " <punc>&</punc> ",
" $" => " <punc>$</punc> ",
" @" => " <punc>@</punc> ",
" #" => " <punc>#</punc> ",
" %" => " <punc>%</punc> ",
" ^" => " <punc>^</punc> ",
" *" => " <punc>*</punc> ",
" _" => " <punc>_</punc> ",
" =" => " <punc>=</punc> ",
" +" => " <punc>+</punc> ",
" |" => " <punc>|</punc> ",
" -" => " <punc>-</punc> ",
"," => "<> <punc>,</punc> ",
"." => "<> <punc>.</punc> ",
"/" => "<> <punc>/</punc> ",
"\\" => "<> <punc>\\</punc> ",
"!" => "<> <punc>!</punc> ",
"?" => "<> <punc>?</punc> ",
":" => "<> <punc>:</punc> ",
";" => "<> <punc>;</punc> ",
"\"" => "<> <punc>\"</punc> ",
"'" => "<> <punc>'</punc> ",
"(" => "<> <punc>(</punc> ",
")" => "<> <punc>)</punc> ",
"{" => "<> <punc>{</punc> ",
"}" => "<> <punc>}</punc> ",
"<" => "<> <punc><</punc> ",
">" => "<> <punc>></punc> ",
"[" => "<> <punc>[</punc> ",
"]" => "<> <punc>]</punc> ",
"&" => "<> <punc>&</punc> ",
"$" => "<> <punc>$</punc> ",
"@" => "<> <punc>@</punc> ",
"#" => "<> <punc>#</punc> ",
"%" => "<> <punc>%</punc> ",
"^" => "<> <punc>^</punc> ",
"*" => "<> <punc>*</punc> ",
"_" => "<> <punc>_</punc> ",
"=" => "<> <punc>=</punc> ",
"+" => "<> <punc>+</punc> ",
"|" => "<> <punc>|</punc> ",
"-" => "<> <punc>-</punc> "
);
$repps = strtr($texttoreplace, $repp);
echo $repps;

请帮忙..

最佳答案

是这对引起了问题,将其删除后就可以了

"" => ",",

正如手册所说:

如果 replace_pairs 包含一个空字符串 ("") 的键,将返回 FALSE。

关于php - strtr 函数不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11481511/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com