Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将prestashop登录系统与我的网站中的其他网页(店外)一起使用?_Php_Cookies_Prestashop 1.6 - Fatal编程技术网

Php 如何将prestashop登录系统与我的网站中的其他网页(店外)一起使用?

Php 如何将prestashop登录系统与我的网站中的其他网页(店外)一起使用?,php,cookies,prestashop-1.6,Php,Cookies,Prestashop 1.6,亲爱的朋友,我已经在我现有的网站上安装了prestashop。我现在的网站有一个我已经建立的登录系统 由于为我的系统安装了prestashop,我想将现有登录名更改为prestashop登录名 至于prestashop文档,为了在prestashop外部访问prestashop cookie,我制作了一个测试页面来检索cookie数据,如下所示: include_once('path_to_prestashop/config/config.inc.php'); include_once('pat

亲爱的朋友,我已经在我现有的网站上安装了prestashop。我现在的网站有一个我已经建立的登录系统

由于为我的系统安装了prestashop,我想将现有登录名更改为prestashop登录名

至于prestashop文档,为了在prestashop外部访问prestashop cookie,我制作了一个测试页面来检索cookie数据,如下所示:

include_once('path_to_prestashop/config/config.inc.php');
include_once('path_to_prestashop/config/settings.inc.php');
include_once('path_to_prestashop/classes/Cookie.php');
$cookie = new Cookie('ps');
print_r($cookie);
但这不起作用,browser说

它包含重定向循环。

正如一些帖子所建议的那样,我试图禁用
SEO友好url
cannonicalURL以禁止直接使用

现在,如果我转到测试页面,它将重定向到prestashop索引页面,而不是显示cookie数据

我应该做些什么来克服这个问题


多谢各位

当您包含
config/config.inc.php
PrestaShop重定向到商店域

以下代码在
classes/shop/shop.php
中导致此行为:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
您可以重写
Shop
类来禁用脚本的重定向

为此,在包含
config/config.inc.php
之前,首先定义
PS\u DISABLE\u SHOP\u REDIRECT
常量:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
然后将以下内容粘贴到重写类中的上一个代码之前:

if (defined('PS_DISABLE_SHOP_REDIRECT')) {
  $id_shop = Configuration::get('PS_SHOP_DEFAULT');
}

当包含
config/config.inc.php
PrestaShop时,会重定向到商店域

以下代码在
classes/shop/shop.php
中导致此行为:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
您可以重写
Shop
类来禁用脚本的重定向

为此,在包含
config/config.inc.php
之前,首先定义
PS\u DISABLE\u SHOP\u REDIRECT
常量:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
然后将以下内容粘贴到重写类中的上一个代码之前:

if (defined('PS_DISABLE_SHOP_REDIRECT')) {
  $id_shop = Configuration::get('PS_SHOP_DEFAULT');
}

当包含
config/config.inc.php
PrestaShop时,会重定向到商店域

以下代码在
classes/shop/shop.php
中导致此行为:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
您可以重写
Shop
类来禁用脚本的重定向

为此,在包含
config/config.inc.php
之前,首先定义
PS\u DISABLE\u SHOP\u REDIRECT
常量:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
然后将以下内容粘贴到重写类中的上一个代码之前:

if (defined('PS_DISABLE_SHOP_REDIRECT')) {
  $id_shop = Configuration::get('PS_SHOP_DEFAULT');
}

当包含
config/config.inc.php
PrestaShop时,会重定向到商店域

以下代码在
classes/shop/shop.php
中导致此行为:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
您可以重写
Shop
类来禁用脚本的重定向

为此,在包含
config/config.inc.php
之前,首先定义
PS\u DISABLE\u SHOP\u REDIRECT
常量:

$shop = new Shop($id_shop);
if (!Validate::isLoadedObject($shop) || !$shop->active)
{
  // No shop found ... too bad, let's redirect to default shop
  $default_shop = new Shop(Configuration::get('PS_SHOP_DEFAULT'));

  // Hmm there is something really bad in your Prestashop !
  if (!Validate::isLoadedObject($default_shop))
    throw new PrestaShopException('Shop not found');

  $params = $_GET;
  unset($params['id_shop']);
  $url = $default_shop->domain;
  if (!Configuration::get('PS_REWRITING_SETTINGS'))
    $url .= $default_shop->getBaseURI().'index.php?'.http_build_query($params);
  else
  {
    // Catch url with subdomain "www"
    if (strpos($url, 'www.') === 0 && 'www.'.$_SERVER['HTTP_HOST'] === $url || $_SERVER['HTTP_HOST'] === 'www.'.$url)
      $url .= $_SERVER['REQUEST_URI'];
    else
      $url .= $default_shop->getBaseURI();

    if (count($params))
      $url .= '?'.http_build_query($params);
  }
  $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302';
  header('HTTP/1.0 '.$redirect_type.' Moved');
  header('location: http://'.$url);
  exit;
}
define('PS_DISABLE_SHOP_REDIRECT', true);
然后将以下内容粘贴到重写类中的上一个代码之前:

if (defined('PS_DISABLE_SHOP_REDIRECT')) {
  $id_shop = Configuration::get('PS_SHOP_DEFAULT');
}

没有人有答案?没有人有答案?没有人有答案?没有人有答案?