这可能是一个非常基本的问题,但是我想知道如何使用PHP和Ajax或任何建议的脚本语言来实现这个。
我想动态生成一个链接,将打开用户配置文件页面,有人建议最好的方法吗?
提前感谢您的回复
通常,动态链接看起来像这样:
mysite.com/user.php?id=23
然后,在user.php
上,你会有这样的内容:
if (!isset($_GET['id']))
die("No user information!!");
else {
$user_id = $_GET['id'];
// Now use $id to query the database and get user information
}
要在另一个页面上生成链接,您只需这样做:
<a href="user.php?id=<?=$user_id?>">My Profile Page</a>
其中$user_id
为当前登录用户的id