本文整理汇总了PHP中api::result方法的典型用法代码示例。如果您正苦于以下问题:PHP api::result方法的具体用法?PHP api::result怎么用?PHP api::result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api
的用法示例。
在下文中一共展示了api::result方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login_action
public function login_action()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (empty($_POST['email']) || empty($_POST['password']) || !account::log_in($_POST['email'], $_POST['password'])) {
return api::result(false);
}
return api::result(true);
}
return api::result(false);
}
示例2: formatted_action
public function formatted_action($key)
{
if (empty($key)) {
return api::result(false, array('message' => 'No_key_provided'));
}
$kb = knowledge_base_article::load_one($key, 'key');
if (!$kb) {
return api::result(false, array('message' => 'Article_not_found'));
}
return api::result(true, array('formatted' => addslashes($kb->formatted())));
}
示例3: inventory_action
public function inventory_action($type)
{
$type = page::arg('type', $type, 'character');
$charId = page::arg('character_id');
$charName = page::arg('name');
$itemType = page::arg('item_type', null, 'all');
$char = null;
if ($charId) {
$char = character::load_one($charId);
} else {
if ($charName) {
$char = character::load_one($charName, 'name');
} else {
if (!character::selected()) {
return api::result(false, array('message' => 'No_character_selected'));
} else {
$char = character::current();
}
}
}
if (!$type) {
$type = 'character';
}
$types = array('character' => inventory::TYPE_CHARACTER, 'vault' => inventory::TYPE_VAULT);
$itemTypes = array('all' => null, 'usable' => item::TYPE_USABLE, 'enchantable' => item::TYPE_ENCHANTABLE, 'destroyable' => item::TYPE_DESTROYABLE, 'loot' => item::TYPE_LOOT, 'equippable' => item::TYPE_EQUIPPABLE, 'material' => item::TYPE_MATERIAL);
if (!isset($types[$type])) {
$itemType = (int) $type;
}
if (!array_key_exists($itemType, $itemTypes)) {
return api::result(false, array('message' => 'Invalid_item_type'));
}
return api::result(true, array($char->inventory($types[$type])->items($itemTypes[$itemType], true)));
}
示例4: result
public function result($type, $args = array(), $status = true)
{
return api::result($status, array($status ? 'type' : 'message' => $type, 'args' => $args));
}