Php 使用会话id或用户信息编辑会话
我想使用会话id或用户信息从另一个php文件更新会话变量。假设用户已登录(会话已打开)。 还有另一个名为receive_notification.php的文件 它从移动应用程序接收http请求并从中获取数据。我试图在用户的MemberPage中包含这些数据Php 使用会话id或用户信息编辑会话,php,session,Php,Session,我想使用会话id或用户信息从另一个php文件更新会话变量。假设用户已登录(会话已打开)。 还有另一个名为receive_notification.php的文件 它从移动应用程序接收http请求并从中获取数据。我试图在用户的MemberPage中包含这些数据 //receives location updates from the app <?php require 'database.php'; require 'model.php'; if(isset($_POST["IMEI"]))
//receives location updates from the app
<?php
require 'database.php';
require 'model.php';
if(isset($_POST["IMEI"])){
//collect data
$imei = filter_input(INPUT_POST, 'IMEI');
$SessionID = filter_input(INPUT_POST, 'Sessionid');
$latitude = filter_input(INPUT_POST, 'Lat');
$longitude = filter_input(INPUT_POST, 'Long');
if(!isset($_SESSION)){
session_id($SessionID);
session_start();
}
//gets phone id
$phoneid = getphoneIdByIMEI($imei);
//gets user's (firstname, lastname, email)
$user = getUserByPhoneID($phoneid);
//echo $latitude ." ".$longtitude;
//trying to update specific user's MemberPage and
//display $latitude and $longtitude
include('../MemberPage.php');
}else {echo "nothing";}
?>
//从应用程序接收位置更新
我试图获取用户并在他的会话中包含$latitude和$longitude,但当我尝试回显它们时,它们在MemberPage.php中没有定义。我现在正想弄清楚这件事。有人能告诉我如何找到特定用户并在会话中包含这些数据吗?检查MemberPage.php页面,它是否有语法错误,或者您是否能够从MemberPage.php页面打印任何数据
尝试检查包含路径并将包含文件移动到页面顶部。include('../MemberPage.php');这一行写在topMemberPage上效果很好,我可以回显所有用户信息(Firstname lastname电子邮件)。唯一的问题是,当我试图打印longtude和lat时,它们并没有被识别。