首頁  >  文章  >  後端開發  >  数组赋值的有关问题

数组赋值的有关问题

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