本文整理汇总了PHP中Photo::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Photo::setId方法的具体用法?PHP Photo::setId怎么用?PHP Photo::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Photo
的用法示例。
在下文中一共展示了Photo::setId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPhotos
/**
* @param String $url
* @param int $id
* @return Photo[]
*/
public static function getPhotos($url)
{
$xh = new XMLHandler($url);
$photoItems = $xh->getNodes("photo");
$photoList = array();
foreach ($photoItems as $photoNode) {
$p = new Photo();
$p->setId($photoNode->getElementsByTagName("id")->item(0)->textContent);
$p->setAlt($photoNode->getElementsByTagName("htmlAlt")->item(0)->textContent);
$p->setOrientation($photoNode->getElementsByTagName("orientation")->item(0)->textContent);
//set thumbnail pic and large pic
$photoInstancesNode = $photoNode->getElementsByTagName("instance");
foreach ($photoInstancesNode as $pi) {
$type = $pi->getElementsByTagName("type")->item(0)->textContent;
/* @var $pi DomElement */
if ($type == "Thumbnail") {
$p->getThumb()->parsePhotoInstance($pi);
} elseif ($type == "Large") {
$p->getLarge()->parsePhotoInstance($pi);
} elseif ($type == "HighRes") {
$p->getHiRes()->parsePhotoInstance($pi);
} elseif ($type == "Custom") {
$p->getCustom()->parsePhotoInstance($pi);
}
}
$photoList[] = $p;
}
return $photoList;
}
示例2: Photo
echo $p->getId();
?>
"><img src="images/delete.png" /><img src="images/show.png" /><img src="images/hide.png" /></a>
</td>
</tr>
</table>
<?php
break;
case 'save':
//TODO$p=$dao->findById($_REQUEST['id']);
$category = $_REQUEST['category'];
$season = $_REQUEST['season'];
$title = $_REQUEST['title'];
$description = $_REQUEST['description'];
$unePhoto = new Photo();
$unePhoto->setId($_REQUEST['id']);
$unePhoto->setCategory($category);
$unePhoto->setSeason($season);
$unePhoto->setTitle($title);
$unePhoto->setDescription($description);
$dao->update($unePhoto);
break;
case 'hide':
$dao->hide($_REQUEST['id']);
break;
case 'show':
$dao->show($_REQUEST['id']);
break;
case 'del':
$dao->delete($_REQUEST['id']);
//TODO$p=$dao->findById($_REQUEST['id']);