Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php使用SSE返回SQL上的最后一次编辑_Php_Variables_Server Sent Events - Fatal编程技术网

php使用SSE返回SQL上的最后一次编辑

php使用SSE返回SQL上的最后一次编辑,php,variables,server-sent-events,Php,Variables,Server Sent Events,我有一个php脚本,它向数据库输入/返回json格式的数据。 我想创建一个SSE脚本,它返回上次更新数据库的时间 <?php header('Content-Type: text/event-stream'); header('Cache-Control: no-cache'); echo "last update:$last"; ?> 我如何安全有效地完成这项工作 我看到的选择是: sql请求-效率不高。 APC存储-在上不受支持 服务器 存储在文件中-不受支持/安全 会话-仅

我有一个php脚本,它向数据库输入/返回json格式的数据。 我想创建一个SSE脚本,它返回上次更新数据库的时间

<?php
header('Content-Type: text/event-stream');
header('Cache-Control: no-cache');
echo "last update:$last";
?> 
我如何安全有效地完成这项工作

我看到的选择是:

sql请求-效率不高。 APC存储-在上不受支持 服务器 存储在文件中-不受支持/安全 会话-仅针对一个用户。
我正在寻找一个在脚本之间传递的简单变量。

如果您只想在页面之间传递值,那么可以使用$\u会话全局数组变量。但我认为,最好将其存储在服务器端,即sql中。