php - 将firestore中的数据放入下一个php文件
问题描述
我在 cloud firestore 中有几个值,并且想要访问每个变量。因此我这样做我的代码
<?php
require __DIR__.'/vendor/autoload.php';
use Google\Cloud\Firestore\FirestoreClient;
$db = new FirestoreClient(
[
'projectId' => 'fakedata-aa798'
]
);
$collectionReference = $db->collection('Test3');
$docRef = $collectionReference->document('User1');
$snapshot = $docRef->snapshot();
$Name= $snapshot['Name'];
$Contact= $snapshot['Contact no:'];
$Email= $snapshot['Email'];
$Location= $snapshot['Location'];
$Locationstatus= $snapshot['Location status'];
$Condition= $snapshot['Condition'];
session_start();
$_SESSION['Name'] = $Name;
$_SESSION['Contact no:'] = $Contact;
$_SESSION['Email'] = $Email;
$_SESSION['Location'] = $Location;
$_SESSION['Location status'] = $Locationstatus;
$_SESSION['Condition'] = $Condition;
?>
现在我想在下一个 PHP 文件中显示值,我使用 session_start 但仍然无法获取值
第 2 页
<?php
session_start();
echo $_SESSION['Name'];
?>
有人能帮我吗?
解决方案
推荐阅读
- android - TokBox (OpenTok) Android SDK 越来越大
- css - 可以重写我的简单 CSS 代码变得更好
- c++ - 使用转义序列处理为带引号的字符串创建 boost::spirit::x3 解析器
- php - XDEBUG_SESSION 不传播页面更改
- python - 为什么在这个简单的 ctypes 示例中出现“访问冲突”错误?
- python - Python - sys.stdin.readline() - 库
- python - Kivy:包含 ScrollView、StackLayout 和 Labels 的屏幕完全不合适
- google-bigquery - 由于 coorelated 子查询,Bigquery 作业从今天开始突然开始失败
- python - 为什么 Python 中的方法比使用相同 dll 的 C# 中的方法慢?
- highcharts - 在标准输出中导出 highcharts-export-server 输出