0

有趣的问题,我希望有一个解决方法——

我正在使用 Joomla 3.0,为此我安装了 Jumi 模块。使用会话变量时,我可以通过简单的登录/创建帐户脚本完美地使用它们,但是当我尝试从 Jumi 脚本访问会话变量时它不起作用,有什么建议吗?

即/Joomla 目录中的所有php 文件都可以访问会话变量。但是,/Joomla/components/com_jumi/files/ 中的 php 文件无法访问会话变量。

在我的“createaccount.php”页面的顶部,我有以下代码:

<?php
   if(!isset($_SESSION)){
   // this starts the session 
   session_start();
   }
?> 

将表单数据输入数据库时​​,经过验证,我有以下代码行将用户名分配给会话变量;

// this sets variables in the session 
    $_SESSION['name']= $_POST["user"];

然后我希望能够从主页访问用户名数据值,称为general.php,所以我在页面顶部使用;

<?php 
 // this starts the session 
 if(!isset($_SESSION))
 {
 session_start(); 
 }
 echo $_SESSION['name'];
?>

我收到未定义的索引错误,因为 Jumi php 文件似乎无法识别会话?

4

0 回答 0