首页  >  文章  >  后端开发  >  数组赋值的有关问题

数组赋值的有关问题

WBOY
WBOY原创
2016-06-13 12:08:13812浏览

数组赋值的问题

<br />public function setParm($parameter, $value) {<br />		$this->parameter[$parameter] = $value;<br />		return $this;<br />	}<br /><br />function geturl($type){<br />     $this->setproductparm($type);<br />     return $this->getData();<br />     }  <br />   <br />private function setproductparm($urltype){<br />     $this->parameter=array();<br />     $this->type="";<br />     $this->setParm("Marketplace",self::marketplaceId);<br />     $this->version="2009-01-01";<br />     switch ($urltype){<br />        case "RequestReport":    <br />            $this->setParm("Action","RequestReport");<br />            $this->setParm("ReportType","_GET_MERCHANT_LISTINGS_DATA_");<br />        break;<br />        case "GetReportList":  <br />            $this->setParm("Action","GetReportList");   <br />            $this->setParm("ReportRequestIdList.Id.1",$this->ReportRequestId);<br />        break;<br />        case "GetReport":  <br />            $this->setParm("Action","GetReport");   <br />            $this->setParm("ReportId",$this->ReportId);  <br />        break;   <br />          <br />              <br />        }<br />        <br />     }<br />

$url1=$aa->geturl("RequestReport");
$url2=$aa->geturl("GetReportList");
$url3=$aa->geturl("GetReport");

我明明每次执行前都清除了数组
$this->parameter=array();
但输出时,每次数组都包含了上次所赋的值。
每次结果:
$url1:ReportType=_GET_MERCHANT_LISTINGS_DATA_
$url2:ReportType=_GET_MERCHANT_LISTINGS_DATA_&ReportRequestIdList.Id.1=123456
$url3:ReportType=_GET_MERCHANT_LISTINGS_DATA_&ReportRequestIdList.Id.1=123456&ReportId=123456

请问是哪里的问题啊???
------解决思路----------------------
你没有给出 getData 的定义,不好说
------解决思路----------------------
<br />//看看是不是下面的方法哪里处理了<br />getData();<br />

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn