【发布时间】:2015-10-25 18:52:59
【问题描述】:
我知道如何在 php 中应用多语言,但我的 url 有问题。
当我单击标签并切换语言时,我会发送一个参数,对吗?但关键是我还需要一个参数来加载页面。
嗯,这有点难以解释。
- 有一个用户列表页面
- 点击其中一个用户并发送一个user_code (
<a href="userInfo.html?user_code=1">user1</a>) - userInfo 页面由 user_code 加载。
- 点击
<a href="?lang=en">english</a>在“userInfo.html”页面切换语言。 - 我需要在同一页面中获取两个参数。
我该怎么做?
//top.php side menu
<ul id="menu1" class="dropdown-menu list-unstyled msg_list animated fadeInDown" role="menu">
<li>
<a href="?lang=ko&arg1=<?= $ARG_1; ?>">Korean</a>
</li>
<li>
<a href="?lang=en&arg1=<?= $ARG_1; ?>">English</a>
</li>
</ul>
\
//user list page to click the user
$user = "<tr class='even pointer'>"
. "<td class=''><a href=\"/userInfo.html?user_code=".$row["code"]."\">"
.$row["name"]."</a></td>"
. "<td class=''>".$row["age"]."</td>"
. "<td class=''>".getDataValue($USER_CATEGORY, $row["vip"])."</td>"
. "<td class=''>".getDataValue($USER_REPU, $row["reputation"])."</td>"
. "<td class=''>".getDataValue($USER_EMAIL, $row["email"])."</td>"
. "<td class=''>".getDataValue($USER_GENDER, $row["gender"])."</td>"
. "<tr>";
【问题讨论】:
-
你必须动态创建你的语言转换器网址。
-
是的,我想要。例如,如果我使用 'localhost/userInfo.html?user_code=1' 这样的 url 加载我的页面,但问题是当我单击语言按钮进行切换时。 url 像这样动态变化 'localhost/userinfo.html?lang=en'。如何动态灵活地更改 url,如 'localhost/userinfo.html?user_code=1&lang=en"?我怎样才能添加其余的 url?
-
你在测试这个功能吗?我没有得到帮助或有问题
标签: php parameters get multilingual