用户会话变量未在功能中设置

时间:2015-04-10 17:26:16

标签: php web-services soap session-variables

我正在尝试在此函数中传递用户会话变量以通过ups获取运费报价。变量没有设置,我试图找到不同的方法设置它们没有任何运气。这只是代码片段,是会话开始是整个代码的开头。谢谢你的帮助!

function processFreightRate()


{
      //create soap request
      $option['RequestOption'] = 'RateChecking Option';
      $request['Request'] = $option;
      $shipfrom['Name'] = 'Good Incorporation';
      $addressFrom['AddressLine'] = '2010 WARSAW ROAD';
      $addressFrom['City'] = $_SESSION['order'][$counter]['f_cityID'];
      $addressFrom['StateProvinceCode'] = $_SESSION['order'][$counter]['f_stateID'];
      $addressFrom['PostalCode'] = $_SESSION['order'][$counter]['f_zipID'];
      $addressFrom['CountryCode'] = 'US';
      $shipfrom['Address'] = $addressFrom;
      $request['ShipFrom'] = $shipfrom;
}

2 个答案:

答案 0 :(得分:1)

$counter未定义,因此无法从会话中提取值。将$counter变量传递给函数   function processFreightRate($counter)这可能会解决您的问题。

答案 1 :(得分:0)

确保该功能可以访问$counter,同时尝试var_dump()变量的$_SESSION来查看传递的内容。