你好吗.希望很好......
我遇到以下代码的问题.该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;
}
Run Code Online (Sandbox Code Playgroud)
阵列在旁遮普,即是一种指法语言......
$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;
Run Code Online (Sandbox Code Playgroud)
Plzz帮助..
小智 5
它是导致问题的这一对,删除它,它的工作原理
"" => ",",
Run Code Online (Sandbox Code Playgroud)
正如手册所说:
如果replace_pairs包含一个空字符串("")的键,则返回FALSE.