如何在用户登录时显示用户特定功能?

发布于 2024-09-12 19:52:06 字数 192 浏览 3 评论 0原文

我正在尝试为我的咨询实践网站编写代码。我知道如何拥有数据库以及如何管理网站上的用户。但现在我想向用户收取他们希望我从头开始构建的自定义功能的费用。 (例如,他们想要一个上传图片的选项或通过第 3 方 API 获取某些报告的能力,这对于本示例来说是唯一的)所以,我的问题是当他们使用他们的 ID 登录时,我如何编写一个 php 代码仅显示该特定用户的特定选项/功能/页面?

I am trying to write code for a site for my consulting practice. I know how to have a database and how to manage users on the site. But now I want to charge users for custom features they want me to build from ground up. (e.g they want an option to upload pictures or ability to get certain reports via 3rd party API, which for purposes of this example is unique) So, my question is when they log in with their ID, how do i write a php code that shows only that particular option/features/page for that particular user?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给妤﹃绝世温柔 2024-09-19 19:52:06

如何在会话中跟踪登录用户?您可以做一些简单的事情,例如:

<?php
if ($_SESSION['userid'] == 4) {
     include('special_feature.php');
} ?>

仅为特定用户嵌入特定代码块(或从数据库中提取该用户列表)...

How do you track the logged in user, in a session? You could do something simple like:

<?php
if ($_SESSION['userid'] == 4) {
     include('special_feature.php');
} ?>

To embed a certain block of code only for a certain user (or pull that user list from the database)...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文