function refreshCache() { $cache = new HugePicsCache(); $pics = array(); $pic1 = new PicCache(2, "http://localhost/photo/casa_201511300320364412.jpg", PicCache::TYPE_CITY); $pic2 = new PicCache(8, "http://localhost/photo/casa_201511300545557067.jpg", PicCache::TYPE_AREA); $pic3 = new PicCache(1, "http://localhost/photo/casa_201511231125319759.jpg", PicCache::TYPE_CASA); array_push($pics, $pic1); array_push($pics, $pic2); array_push($pics, $pic3); $cache->refresh($pics); var_dump($cache->getHugePics()); }
<div class="huge_pics_div"> <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/cache/HugePicsCache.php'; ?> <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/vo/PicCache.php'; ?> <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/AreaDao.php'; ?> <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/casarover/application/models/CasaDao.php'; ?> <?php $hugePicsCache = new HugePicsCache(); $picCacheArray = $hugePicsCache->getHugePics(); for ($i = 0; $i < count($picCacheArray); $i++) { $picCache = $picCacheArray[$i]; $type = $picCache->type; $id = $picCache->id; $path = $picCache->path; $link_info = new stdClass(); if ($type == PicCache::TYPE_CITY) { $areaDao = new AreaDao(); $area_row = $areaDao->getById($id); $link_info->type = "城市"; $link_info->name = $area_row['value']; } else { if ($type == PicCache::TYPE_AREA) { $areaDao = new AreaDao(); $area_row = $areaDao->getById($id);