【发布时间】:2016-04-10 19:56:51
【问题描述】:
我需要为链接提供 encodeURIComponent。这个问题和PHP variable error in unicode的答案有关。请帮帮我。
<?php
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
$NewValue="";
if(!empty($_GET['NewValue'])){
echo $NewValue=$_GET['NewValue'];//this variable is the problem;
}
$Value="நன்றி";
?>
<a href="test1.php?NewValue=<?php echo $Value;?>">Click here</a>
</body>
</html>
【问题讨论】:
-
我不确定我是否明白你在问什么。
urlencode? -
见这里stackoverflow.com/questions/36533008/…。他们解释了 encodeURIComponent 来检索 Unicode 变量值。因此,这里也使用了相同的 Unicode 变量。所以,encodeURIComponent 是否需要使用
-
那么,您是否要求使用 php 等效于
encodeURIComponent? -
我在问上面的代码是对还是错。如果它是错误的,请告诉我正确的代码。因为我在那里使用了 Unicode 变量。
-
人们已经回答了您的问题。在 PHP 中,它被称为
urlencode()而不是encodeURIComponent(),即 javascript。
标签: php unicode encodeuricomponent