php对特殊字符没有意义
**mb_内部_编码();输出:“UTF-8” textarea输入:“–b”| php输出:脚本未转换为“a” 文件没有BOM** 这些可能是其他原因??我还能尝试什么?php对特殊字符没有意义,php,encoding,special-characters,mbstring,Php,Encoding,Special Characters,Mbstring,**mb_内部_编码();输出:“UTF-8” textarea输入:“–b”| php输出:脚本未转换为“a” 文件没有BOM** 这些可能是其他原因??我还能尝试什么? <?php mb_detect_order('UTF-8,eucjp-win,sjis-win'); mb_internal_encoding('UTF-8'); echo mb_internal_encoding(); function convert($a) str_replace('â','a',$string)
<?php
mb_detect_order('UTF-8,eucjp-win,sjis-win');
mb_internal_encoding('UTF-8');
echo mb_internal_encoding();
function convert($a) str_replace('â','a',$string);
$e=$_POST['aaa'];
?>
<!doctype html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" >
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
</head>
<form method="post" action="#">
<textarea id="aaa" name="bbb" placeholder="send" ></textarea>
应该是:
str_replice('â','a',$string);
有一些打字错误:
str_replace('â','a',$string);
应该是:
function convert($a) str_replice('â','a',$string);
不是replice()
,$string
应该是$a
,如果你想看到函数的输出,你应该返回它
所以当你打电话时:
function convert($a){return str_replace('â','a',$a);}
它的输出很好你有什么问题??发布代码和错误将永远不会得到解决方案,发布您试图实现的内容和您获取的脚本未转换的错误–aTryvar_dump(bin2hex(“-”)
),并告诉我们结果。脚本在本地主机和其他主机上正确转换,但在我的主机上不转换特殊字符对不起,我写错了,在脚本中:“str_replace”@user1419633,如果你试图理解我的答案,那么你的问题就解决了,这一行函数转换($a){return stru replace('–','a','a);}
告诉一切;)没有解决,这不是语法问题。在某些服务器上,脚本运行正常。真代码“stru replace”对不起,我写错了,在脚本中:”str_替换“
<?php echo convert("â");?>