Magento: ?___SID=U 出现在一些网址中 [英] Magento: ?___SID=U appearing in some urls

查看:33
本文介绍了Magento: ?___SID=U 出现在一些网址中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释一下为什么 ?___SID=U 出现在我网站上的某些 Magento URL 中而不是其他人吗?

Can someone please explain why ?___SID=U is appearing in some Magento URLs on my site and not others?

我认为这与会话有关,但我并不完全清楚.此外,更令人困惑的是它只出现在某些 URL 中而不出现在其他 URL 中.

I think it has something to do with sessions but I am not entirely clear. Also, what makes it more confusing is the fact that it's only appearing in some URLs and not others.

我不需要知道如何删除它,因为我知道管理区域中的设置.我真的很想解释它是什么,它的目的是什么以及为什么它会显示在某些页面上而不是其他页面上.我宁愿完全了解正在发生的事情,也不愿盲目地遵循有关如何删除它的一些建议.

I don't need to know how to remove it as I am aware of the setting in the admin area. I would really like an explanation of what it is, what its purpose is and why it would show on some pages and not others. id rather understand what's going on fully than blindly follow some advice as to how to remove it.

推荐答案

除了 Brendan 的回答之外,___SID=U 在缓存中用作会话 ID 的占位符.它被替换为 Mage_Core_Model_Url::sessionUrlVar(),后者又调用 Mage_Core_Model_Url::sessionVarCallback().这些方法是从 Mage_Core_Block_Abstract::_afterCacheUrl() 调用的,这意味着在块输出中找到的任何 URL 都将包含正确的会话 ID(如果需要).

I addition to Brendan's answer, the ___SID=U is used in the cache as a placeholder for the session ID. It is replaced by Mage_Core_Model_Url::sessionUrlVar() which in turn calls Mage_Core_Model_Url::sessionVarCallback(). These methods are called from Mage_Core_Block_Abstract::_afterCacheUrl(), which means that any URL found in block output will contain the correct session ID (if needed).

因此,要以正确的方式"删除您自己代码中的参数,请使用以下命令:

So to get rid of the parameter in your own code the "right way" use this:

$url = Mage::getUrl('some/magento/route'); // might append ___SID parameter
$url = Mage::getModel('core/url')->sessionUrlVar($url); // process ___SID

如果该字符串仍显示在呈现的页面中,则为错误.您使用的是一些自定义缓存模块,还是使用非标准方式生成 URL?

If the string still displays in the rendered page that is a bug. Are you using some custom caching module, or generating URL's using a non-standard way?

这篇关于Magento: ?___SID=U 出现在一些网址中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆