本文整理匯總了PHP中Illuminate\Routing\Route::getCompiled方法的典型用法代碼示例。如果您正苦於以下問題:PHP Route::getCompiled方法的具體用法?PHP Route::getCompiled怎麽用?PHP Route::getCompiled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Routing\Route
的用法示例。
在下文中一共展示了Route::getCompiled方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: matches
/**
* Validate a given rule against a route and request.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
* @return bool
*/
public function matches(Route $route, Request $request)
{
if (is_null($route->getCompiled()->getHostRegex())) {
return true;
}
return preg_match($route->getCompiled()->getHostRegex(), $request->getHost());
}
示例2: matches
/**
* Validate a given rule against a route and request.
*
* @param \Illuminate\Routing\Route $route
* @param \Illuminate\Http\Request $request
*
* @return bool
*/
public function matches(Route $route, Request $request)
{
$regex = $route->getCompiled()->getRegex();
if (str_contains($request->getRequestUri(), '/wp-admin')) {
return preg_match(str_replace('$#s', '(?:&.+)?$#s', $regex), rawurldecode($request->getRequestUri()));
}
$path = $request->path() == '/' ? '/' : '/' . $request->path();
return preg_match($regex, rawurldecode($path));
}
示例3: matches
/**
* Validate a given rule against a route and request.
*
* @param LaravelRoute $route illuminate route
* @param LaravelRequest $request illuminate request
*
* @return bool
*/
public function matches(Route $route, Request $request)
{
$path = $request->path() == '/' ? '/' : '/' . $request->path();
$firstSegment = $request->segment(1);
if ($firstSegment === null) {
return true;
} else {
return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
}
}
示例4: matches
public function matches(Route $route, Request $request)
{
$path = $request->path() == '/' ? '/' : '/' . $request->path();
return preg_match($route->getCompiled()->getRegex(), rawurldecode($path));
}
示例5: canReview
/**
* canReview
*
* @param Route $route laravel route
* @param Request $request laravel request
*
* @return bool
*/
private function canReview(Route $route, Request $request)
{
if (!is_null($route->getCompiled()->getHostRegex())) {
return false;
}
$firstSegment = $request->segment(1);
if ($firstSegment === null) {
return true;
}
$uri = $route->uri();
if (strpos($uri, '{') === false) {
return false;
}
$actions = $route->getAction();
if (isset($actions['module'])) {
return true;
}
return false;
}
示例6: getRouteIdentity
/**
* Transform route into string route identity
*
* @param Illuminate\Routing\Route $route
* @return string formatted '<route_methods> <route_regex>'
*/
protected function getRouteIdentity(Route $route)
{
$route->bind($this->app['request']);
$regex = $route->getCompiled()->getRegex();
$methods = implode('|', $route->getMethods());
return $methods . ' ' . $regex;
}