Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Opencart 中有一个自定义页面。在此页面中,我使用基于 PHP 和 Javascript 的文本编辑器。现在我需要检查用户是否已登录,以便显示更多选项。我在谷歌上搜索过,但我没有找到任何东西。
在您的控制器(该自定义页面)中,您可以执行以下操作:
if($this->customer->isLogged()) { echo "Customer is logged in and his ID is " . $this->customer->isLogged(); } else { echo "Customer is not logged in"; }
这假设自定义页面在前端并且用户实际上是指客户(这个假设是因为在后端每个用户都必须在显示任何页面之前登录)。