问题
I use following statement for read the value and its works well.
$PlaceName=$_REQUEST['PlaceName'];
but here is one problem with above statement. If we pass some special type character (like Burger King ®), then variable $PlaceName contains blank value. Note that the reason of this problem is the symbol of registered trademark (®)
So how can I read this type of symbol in PHP by correcting above statement?
回答1:
You can try
header('Content-Type: text/html; charset=utf-8');
$PlaceName= "Burger King ®" ;
echo $PlaceName;
回答2:
It has to do with your encoding, make sure your output is set to utf8.
I just tested this code and output was valid.
<form method="post" action="">
<input type="text" name="name" />
<input type="submit" />
</form>
<?php
if ($_POST){
$name = $_POST['name'];
echo '<pre>';
var_dump($_POST);
echo '</pre>';
echo '<hr />';
echo $name;
}
来源:https://stackoverflow.com/questions/12980207/read-special-character-like-register-trademark