【发布时间】:2014-10-21 11:54:55
【问题描述】:
我尝试在打开购物车成功页面中设置像素,我有这个代码:
$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=0&advertiser_id=2158&offer=2158VxTkF:0" alt="" style="width: 0; height: 0; position:absolute;" /><div id="footer">
如果我设置
$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">
【问题讨论】:
-
$this->session->data['order_id'];不强制转换为 int 的值是多少? -
我试试 echo $order_id $total_price ?> 这也可以。然后他们“$order_id=(int)$this->session->data['order_id'];”和“$total_price=$this->cart->getTotal();” .我可以在页面上看到他们,但在查看源代码时为空 .
-
等我创建截图
-
我和 eddard 的回答一样怀疑;你确定你已经在那个页面上开始了会话吗?
-
想知道为什么在连接值时要转换为
(int)