<?php
// $searchResult is type of Outcome
// This is what we do:
dList::lessAnchor($searchResult)->showElement();
dList::moreAnchor($searchResult)->showElement();
/**
* @returns vAnchor (can get showed with showElement() - not part of the problem)
*/
public static function lessAnchor(Outcome $searchResult){
$searchData = $searchResult->searchData;
$searchData->Page = $searchData->Page - 1; // (!1)
return self::basicAnchor($searchData, "Back");
}
/**
* @returns vAnchor (can get showed with showElement() - not part of the problem)
*/
public static function moreAnchor(Outcome $searchResult){
$searchData=$searchResult->searchData;
$searchData->Page = $searchData->Page + 1; // (!2)
return self::basicAnchor($searchData, "More");
}
当我调用dList::lessAnchor()
时$searchResult
,它会修改 的属性,$searchData->Page
如您所见,将其减 1,标记为(!1)
。过了一会儿(下面一行),我再次打电话dList::moreAnchor()
。$searchResult
为什么我看到标记Page
处的属性减少了 1 (!2)
?我没有$searchResult
通过引用。