我需要在外部 PHP 页面中显示 prestashop 客户 ID。
在官方文档http://doc.prestashop.com/display/PS15/Diving+into+PrestaShop+Core+development )
我找到了php代码:
如果您需要从非 PrestaShop 代码访问 PrestaShop 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'); // Use "psAdmin" to read an employee's cookie.
所以我尝试了:
include_once('config/config.inc.php');
include_once('config/settings.inc.php');
include_once('classes/Cookie.php');
$cookie = new Cookie('ps');
$id_client = $cookie->id_customer;
echo $id_client;
但什么都没有显示,我尝试了其他令牌,只有“date_add”有效
我的代码有什么问题?