通过会话从 ZEND 页面传递变量到 PHP 本机页面

发布于 2024-11-29 14:13:03 字数 79 浏览 0 评论 0原文

您认为是否可以从 Zend 会话将变量传递到 php 本机页面会话? 这两个页面位于同一域的同一服务器上,因为我不想通过网址发送变量。 谢谢!!

Do you think is it possible from a Zend session to pass a variabiles to a php native page session?
The 2 pages are on the same server on the same domain, because I don't want to send the variables through the url.
Thx!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

起风了 2024-12-06 14:13:03

在 Zend 框架基本会话使用文档中,它指出:

Zend_Session_Namespace 实例提供主要 API
在 Zend Framework 中操作会话数据。使用命名空间
隔离所有会话数据,尽管存在默认命名空间
那些只需要一个名称空间来存储所有会话数据的人。
Zend_Session 使用 ext/session 及其特殊的 $_SESSION
超全局作为会话状态数据的存储机制。尽管
$_SESSION 在 PHP 的全局命名空间中仍然可用,开发人员
应该避免直接访问它,这样 Zend_Session 和
Zend_Session_Namespace 可以最有效、最安全地提供其
与会话相关的功能套件。

Zend_Session_Namespace 的每个实例对应于
$_SESSION 超全局数组,其中命名空间用作键。

$myNamespace = new Zend_Session_Namespace('myNamespace');

// $myNamespace 对应于 $_SESSION['myNamespace']

可以将 Zend_Session 与其他代码结合使用
直接使用$_SESSION。然而,为了避免出现问题,它是高度
建议此类代码仅使用 $_SESSION 中不存在的部分
对应于 Zend_Session_Namespace 的实例。

In the Zend framework documentation for basic session usage it states that:

Zend_Session_Namespace instances provide the primary API for
manipulating session data in the Zend Framework. Namespaces are used
to segregate all session data, although a default namespace exists for
those who only want one namespace for all their session data.
Zend_Session utilizes ext/session and its special $_SESSION
superglobal as the storage mechanism for session state data. while
$_SESSION is still available in PHP's global namespace, developers
should refrain from directly accessing it, so that Zend_Session and
Zend_Session_Namespace can most effectively and securely provide its
suite of session related functionality.

Each instance of Zend_Session_Namespace corresponds to an entry of the
$_SESSION superglobal array, where the namespace is used as the key.

$myNamespace = new Zend_Session_Namespace('myNamespace');

// $myNamespace corresponds to $_SESSION['myNamespace']

It is possible to use Zend_Session in conjunction with other code that
uses $_SESSION directly. To avoid problems, however, it is highly
recommended that such code only uses parts of $_SESSION that do not
correspond to instances of Zend_Session_Namespace.

眼眸里的快感 2024-12-06 14:13:03

在我的经典 php 中,我总是这样写:

session_start();
$_SESSION['name'] = 'myname';

并进入第二页:

session_start();
echo $_SESSION['name']

一切正常。
现在进入 zend 页面(如果我理解的话)我应该写:

$myNamespace = new Zend_Session_Namespace('myname');

但是在第二个 php 本机页面中?
有点困惑……抱歉,谢谢。

附:当然,在引导程序中有 Zend_Session::start()

In my classic php I always wrote:

session_start();
$_SESSION['name'] = 'myname';

and into the second page:

session_start();
echo $_SESSION['name']

and everything works fine.
Now into the zend page (if I understood) I should write:

$myNamespace = new Zend_Session_Namespace('myname');

but in the second php native page?
Bit confused... sorry and thank you.

ps. In the bootstrap of course there is the Zend_Session::start()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文