本文整理汇总了PHP中REST::getRouteName方法的典型用法代码示例。如果您正苦于以下问题:PHP REST::getRouteName方法的具体用法?PHP REST::getRouteName怎么用?PHP REST::getRouteName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类REST
的用法示例。
在下文中一共展示了REST::getRouteName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public static function save()
{
$insert['url'] = $_GET['r'];
$insert['route'] = REST::getRouteName();
$insert['params'] = json_encode(REST::getInputs());
$insert['ip'] = $_SERVER['REMOTE_ADDR'];
PG::insert('logs', $insert);
}
示例2: __construct
public function __construct($method = null, $var = null)
{
if (is_null($method)) {
return;
}
$this->inputs = REST::getInputs();
$route_name = REST::getRouteName();
if (substr($route_name, -4) == ':num') {
$id = REST::getRouteId();
$this->{$method}($id);
}
if (!is_null($var)) {
$this->{$method}($var);
}
$this->{$method}();
}
示例3: PostsController
return new PostsController('readBySlug', $var);
case 'get:posts-search-var':
return new PostsController('search', $var);
case 'get:gamers':
return new GamersController('all');
case 'post:users-facebook':
return new UsersController('singinByFacebook');
case 'post:users-token':
return new UsersController('readByToken');
case 'post:ms-newlesson':
return new MesalvaController('newLesson');
case 'post:ms-readlesson':
return new MesalvaController('readLesson');
default:
return null;
}
}
$url_last = count(Globals::get('url'));
$try = bothRoutes(REST::getRouteName());
while (is_null($try) && $url_last > 0) {
$url = Globals::get('url');
$var = $url[--$url_last];
$url[$url_last] = 'var';
$route = strtolower($_SERVER['REQUEST_METHOD']) . ':';
$route .= implode('-', $url);
$try = bothRoutes($route, $var);
if (!is_null($try)) {
exit;
}
}
REST::return404(['route' => Globals::get('route'), 'inputs' => REST::getInputs()]);