PHP会话回声0
我尝试在打开购物车成功页面中设置像素,我有以下代码:PHP会话回声0,php,session,opencart,Php,Session,Opencart,我尝试在打开购物车成功页面中设置像素,我有以下代码: $order_id=(int)$this->session->data['order_id']; $total_price=$this->cart->getTotal(); $output= "<img src=\"http://track.lead-r.ru/?method=reportAction&transaction_id=". $order_id . "&advertiser_id=2
$order_id=(int)$this->session->data['order_id'];
$total_price=$this->cart->getTotal();
$output= "<img src=\"http://track.lead-r.ru/?method=reportAction&transaction_id=". $order_id . "&advertiser_id=2158&offer=2158VxTkF:". $total_price ."\" alt=\"\" style=\"width: 0; height: 0; position:absolute;\" />";
一切都很好
<img src="http://track.lead-r.ru/?method=reportAction&transaction_id=123&advertiser_id=2158&offer=2158VxTkF:123" alt="" style="width: 0; height: 0; position:absolute;" /><div id="footer">
看这个我以前从未使用过opencart,但我使用过codeigniter,它看起来很相似,会话返回0的原因是因为会话实际上返回了false,并且因为您正在将其转换为int,所以它显示为0。如果可能,请检查您设置会话数据的位置。会话->数据['order_id']的值是多少代码>没有将其强制转换为int?我也尝试过这样做。然后他们“$order_id=(int)$this->session->data['order_id'];”和“$total_price=$this->cart->getTotal()”。我可以在页面上看到他们的代码,但在视图中源代码是空的。等等,我创建了screnshotsI,在他的回答中分享了eddard的怀疑;您确定已在该页面上启动会话吗?想知道在连接值时为什么强制转换为
(int)
$order_id=123;
$total_price=123;
<img src="http://track.lead-r.ru/?method=reportAction&transaction_id=123&advertiser_id=2158&offer=2158VxTkF:123" alt="" style="width: 0; height: 0; position:absolute;" /><div id="footer">