如何使用PHP读取unicode网址? [英] How do I read a unicode url with PHP?
问题描述
我有一个unicode url:\test.php?sText =Московский
我想使用$ _Get函数来处理sText的值。我对test.php的代码是:
<?php
$ sVar = $ _GET ['sText ];
echoVariable = $ sVar;
?>
问题在于上面的问题是bach:Variable = ?????????
我需要做什么? 解决方案
所有的反馈。
我已经尝试了所有的例子,但我仍然回到问号,即使保存为utf-8。
是否有php.ini设置我可能需要添加/启用可能允许unicode支持?
目前,无论如何,以下代码:
< html>
< head>< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>< / head>
< body>
<?php
$ sVarControl =Московский;
$ sVar = $ _GET ['sText'];
echoControl = $ sVarControl< br />;
echoVariable = $ sVar< br />;
?>
< / body>
< / html>
产生以下输出:
Control =Московский
变量= ??????????
<因此,该页面能够处理和显示unicode。这可能是$ _GET函数的限制吗?
编辑
我刚刚尝试在Google Chrome中运行该页面,并且工作正常。这让我想到了它的一个IE设置。但是什么?我该如何解决它?
I have a unicode url: \test.php?sText=Московский
I would like to use the $_Get function to work with the value of sText. The code I have for test.php is:
<?php
$sVar = $_GET['sText'];
echo "Variable = $sVar";
?>
Problem is that the above is coming bach as: Variable = ??????????
What do I need to do?
Thanks for all the feedback.
I have tried all the examples but I still get back question marks, even after saving as utf-8.
Is there a php.ini setting I might need to add/enable maybe to allow unicode support?
Currently, for me anyway, the following code:
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<body>
<?php
$sVarControl = "Московский";
$sVar = $_GET['sText'];
echo "Control = $sVarControl <br />";
echo "Variable = $sVar <br />";
?>
</body>
</html>
Produces the following output:
Control = Московский
Variable = ??????????
So the page is capable of working with and displaying unicode. Is this a limitationof the $_GET function maybe?
EDIT
I have just tried running the page in Google Chrome and it is working perfectly. This leads me to think its an IE setting. But what? And how do I work around it?
这篇关于如何使用PHP读取unicode网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!