drnycqxwz63508434 2016-12-07 15:10
浏览 61

如何通过Web服务使用Magento前端cookie值来获取Magento每个会话值?

We are developing separate home page from Magento and accessing information from Magento through Web Services and will integrate this external home with existing Magento website. But on this home page I am facing a problem related to session I have created a frontend cookie on this external home page. But I have no idea how can I get session values by using frontend cookie value.

I am working on this problem from last 1 week please post your valuable answer from which I can resolve my problem.

  • 写回答

1条回答 默认 最新

  • dongzanghong4379 2016-12-07 16:49
    关注

    Start a PHP Session A session is started with the session_start() function.

    Session variables are set with the PHP global variable: $_SESSION.

    Create a new page called "test_session1.php". In this page, we start a new PHP session and set some session variables:create a page called "test_session.php". From this page, you will access the session information we set on the first page ("test_session1.php").

    the session variables are not passed individually to each new page, instead, they are retrieved from the session we open at the beginning of each page (session_start()).

    All session variable values are stored in the global $_SESSION variable:

    <?php
    // Start the session
    session_start();
    ?>
    <!DOCTYPE html>
    <html>
    <body>
    
    <?php
    // Set session variables
    $_SESSION["favcolor"] = "pink";
    $_SESSION["favanimal"] = "goat";
    echo "Session variables are set.";
    ?>
    
    Get PHP Session Variable Values
    

    Create another page called "test_session2.php". From this page, we will access the session information we set on the first page ("test_session1.php").

    Session variables are not passed individually to each new page, instead, they are retrieved from the session we open at the beginning of each page (session_start()).

    All session variable values are stored in the global $_SESSION variable:

    Another way is to print session variables

    <?php
    session_start();
    ?>
    <!DOCTYPE html>
    <html>
    <body>
    
    <?php
    print_r($_SESSION);
    ?>
    
    </body>
    </html>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 我的数据无法存进链表里
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端