Home  >  Article  >  Backend Development  >  数组赋值的有关问题

数组赋值的有关问题

WBOY
WBOYOriginal
2016-06-13 12:08:13815browse

数组赋值的问题

<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 />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn