本文整理汇总了PHP中Articles::get_attributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Articles::get_attributes方法的具体用法?PHP Articles::get_attributes怎么用?PHP Articles::get_attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Articles
的用法示例。
在下文中一共展示了Articles::get_attributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* get one article by id, nick name or by handle
*
* @param int the id of the article
* @param boolean TRUE to always fetch a fresh instance, FALSE to enable cache
* @return the resulting $item array, with at least keys: 'id', 'title', 'description', etc.
*/
public static function get($id, $mutable = FALSE)
{
$output = Articles::get_attributes($id, '*', $mutable);
return $output;
}
示例2: die
}
// no not kill script validation
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'HEAD') {
return;
}
// not found -- help web crawlers
if (!isset($item['id'])) {
Safe::header('Status: 404 Not Found', TRUE, 404);
die(i18n::s('No item has the provided id.'));
// permission denied
} elseif (!$permitted) {
Safe::header('Status: 401 Unauthorized', TRUE, 401);
die(i18n::s('You are not allowed to perform this operation.'));
// retrieve some attributes
} elseif ($action) {
$response = Articles::get_attributes($item['id'], $action);
// encode result in JSON
$output = Safe::json_encode($response);
// allow for data compression
render_raw('application/json; charset=' . $context['charset']);
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $output;
}
// the post-processing hook, then exit
finalize_page(TRUE);
// update some attributes
} else {
if (Articles::put_attributes($_REQUEST)) {
die('OK');
}