本文整理汇总了PHP中Ad::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Ad::load方法的具体用法?PHP Ad::load怎么用?PHP Ad::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ad
的用法示例。
在下文中一共展示了Ad::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadAndCheck
public static function loadAndCheck($adId, \User $user = null, $checkStatus = true, $udid = null)
{
$isValid = true;
$ad = new \Ad();
$ad->load($adId);
if ($checkStatus && !$ad->editable()) {
throw new \Exception('can not update deleted Ad', 504);
}
if ($user && $user->isFrozen()) {
throw new \Exception('frozen owner', 503);
}
if (!$user && $udid || $user && $ad->userId != $user->id && $user->type != \User::TYPE_SUPERMAN) {
throw new \Exception('invalid owner for ad', 503);
}
return $ad;
}
示例2: Ad
<?php
require_once 'Kijiji.php';
$id = @$_GET['id'];
$c = new Ad();
$c->id = $id ? $id : 11652477;
$c->load();
print "<h1>{$c->name}</h1><p>publisher:<a href=user.php?id={$c->user->id}>{$c->user->load()->name}</a><p>";
foreach ($c->category->load()->toRoot() as $cc) {
print "<a href=listing.php?id={$cc->id}>{$cc->name}</a>|";
}
print "<p>";
foreach ($c->area->load()->toRoot() as $cc) {
print "<a href=area.php?id={$cc->id}>{$cc->name}</a>|";
}
print "<p>{$c->content}<p>";
foreach ($c->comments() as $cc) {
print "<li><a href=user.php?id={$cc->userId}>{$cc->userNick}</a>:{$cc->content}<br>";
}