Yaf_Route_Static::match

(Yaf >=1.0.0)

Yaf_Route_Static::match判断路由是否匹配 URI

说明

public function Yaf_Route_Static::match(string $uri): bool

判断静态路由是否匹配某个 URI。由于静态路由可以匹配任何 URI,此方法总是返回 true

参数

uri

要检查的 URI。

返回值

总是返回 true

示例

示例 #1 Yaf_Route_Static::match() 示例

<?php
$route = new Yaf_Route_Static();

/* 静态路由可以匹配任何 URI */
var_dump($route->match("/product/detail/id/10"));
var_dump($route->match("/"));
?>

以上示例的输出类似于:

bool(true)
bool(true)

参见