4D Web 服务器和会话变量
我正在开发一个使用专有 DBMS“第四维”制作的网站。我真的挣扎这个问题,因为我仍然是一个初学者,而且我只有在客户端服务器应用程序上使用 PHP 的经验。 4D 提供了一个 Web 服务器,可以处理 GET 和 POST 请求,并向客户端发送基本响应。
我的问题是: 似乎没有与 PHP 的 $_SESSION
等效的方法来存储持久变量,但我必须在访问者会话期间保留浏览历史记录,实现这一目标的好方法是什么?
我什至不知道如何在访问期间识别单个访客。 我真的很感激一些帮助。 问候, caffein
TL;DR 用任何语言模拟 PHP 会话的最佳方法是什么?
I'm working on a Website made with the proprietary DBMS "4th Dimension". I'm really struggling with this, as I'm still a beginner, and I only have experience with PHP on client-server apps. 4D provides a Web Server that can handle GET and POST requests, and send basic responses to the client.
My question is:
There seems to be no equivalent of PHP's $_SESSION
to store persistant variables, but I have to keep a browsing history during the visitor's session, what's the good way to achieve that?
I don't even have a clue on how I could identify a single visitor during his visit.
I would really appreciate some help.
Regards,
caffein
TL;DR What's the best way to mimic PHP's session in any language?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 4D 知识库查看此峰会会议:Web 会话管理:跟踪您的 Web 用户 。它包含注释和示例 .4DB。
我还建议在 KB 和 iNUG 邮件列表上进行更彻底的搜索(您必须是手动批准后才能发帖,但可以浏览档案)。
尽管我很喜欢,但 iNUG 确实是接触 4D 开发人员的最佳场所。
Check out this Summit session from the 4D knowledge base: Web Session Management: Tracking Your Web Users. It is complete with notes and a sample .4DB.
I'd also recommend a more thorough search on the KB and the iNUG mailing list (you have to be manually approved before you can post, but you can browse archives).
As much as I like SO the iNUG really is the best place to get in touch with 4D devs.
4d v14 具有本机会话管理;要激活它,只需在数据库设置中设置“自动会话管理”选项即可(cfr 4d Web 会话管理 ) 或使用命令 WEB SET OPTION(Web Keep session; 真的)。
会话从 4d 开始使用 cookie 进行维护;每个过程变量和记录选择均得到维护。
在“On Web Connection”数据库方法的代码中,您可以编写:
The 4d v14 has native session management; to active it it is enough to set on the "Automatic Session Management" option in Database Settings ( cfr 4d Web Session Management ) or use the command WEB SET OPTION(Web Keep session; true).
The session is maintained from 4d using cookies; every process variable and records selection is maintained.
In the code of "On Web Connection" Database method you can write: