简体   繁体   English

移动和桌面站点切换

[英]Mobile and Desktop site switch

I have two different codeigniter CMS for desktop and mobile versions of site. 对于站点的桌面版和移动版,我有两个不同的codeigniter CMS。 I use codeigniter user agent to detect mobile and redirect to mobile version. 我使用codeigniter用户代理检测移动设备并重定向到移动版本。 I have a link in mobile site to browse the desktop version as well. 我在移动网站上也有一个链接,也可以浏览桌面版本。 I used session and cookie separately, one by one in mobile cms and tried to get those values in desktop cms but it was different cms so not possible. 我分别在移动cms中分别使用会话和cookie,并尝试在台式机cms中获取这些值,但是它是不同的cms,因此不可能。 How can I switch from mobile to desktop condition there codeigniter user agent is also enabled. 在启用了代码点火器用户代理的情况下,如何从移动设备切换到桌面状态。

Any help appreciated 任何帮助表示赞赏

Assuming that the two sites are under the same domain ( eg www.site.com and mobile.site.com ), you can have cookies that are available for both, by specifying their domain with a leading period ( ie .site.com ). 假设两个站点位于同一个域(例如www.site.commobile.site.com )下,则可以通过指定两个域名的前导时间段(即.site.com )来获得可用于这两个站点的Cookie。 。

That way you can access the cookies from both sites, and if your cookies are the session cookies, you can have a common session as well. 这样,您可以从两个站点访问cookie,并且如果您的cookie是会话cookie,那么您也可以拥有一个公共会话。

For CodeIgniter, you can use the setting : 对于CodeIgniter,您可以使用以下设置:

 $config['cookie_domain']    = ".site.com";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM