本文整理汇总了PHP中rest::run方法的典型用法代码示例。如果您正苦于以下问题:PHP rest::run方法的具体用法?PHP rest::run怎么用?PHP rest::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rest
的用法示例。
在下文中一共展示了rest::run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once "include/lib/database.php";
require_once "include/lib/rest.php";
$db['master']['mmo'] = array("host" => "localhost", "db" => "mmo", "user" => "root", "pass" => "", "prefix" => "");
$database = new database($db);
$database->set_active("master", "mmo");
$rest = new rest(isset($_REQUEST['format']) ? $_REQUEST['format'] : "xml");
$rest->set_setting("caching", false);
$rest->add("post", "register", function ($x1) use(&$database) {
$array['state'] = 1;
$username = $_REQUEST['username'];
$password = md5($_REQUEST['password']);
$r1 = $database->get_row("SELECT user_id FROM users WHERE user_username = '{$username}'");
if (!$r1) {
$database->query("INSERT IGNORE INTO users SET user_username = '{$username}', user_password = '{$password}'");
} else {
$array['state'] = 0;
}
return $array;
});
$rest->run("get,post", $_GET['virtual_path']);