php代码段:
$name = "天书"; //需要传递给url的游戏名称
$name = urlencode($name);
$smarty->assign('name', );
$smarty->display('index.tpl');
index.tpl:
<script src="/index/getName?name={$name}"></script> //$name='%E5%A4%A9%E4%B9%A6';
php代码段:
function getName(){
$name = $_GET['name']
$name = urldecode($name);
echo $name;
}
output:
天书