-1
<?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>

**mb_internal_encoding(); output: "UTF-8"

textarea input: "âb" || php-output:âb script not convert "â"=>"a"

file is without BOM**

these may be other reasons?? what else can I try?

4

2 回答 2

0

some typos there :

function convert($a) str_replice('â','a',$string);

should be :

function convert($a){return str_replace('â','a',$a);}

not replice(),$string should be $a , also if you want to see the output from the function you should return it.

so when you call:

<?php echo convert("â");?>

it would output just fine

于 2015-01-10T10:58:18.467 回答
0
str_replice('â','a',$string);

应该:

 str_replace('â','a',$string);
于 2015-01-10T10:52:57.207 回答