本文整理汇总了PHP中Uri::routedsegments方法的典型用法代码示例。如果您正苦于以下问题:PHP Uri::routedsegments方法的具体用法?PHP Uri::routedsegments怎么用?PHP Uri::routedsegments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Uri
的用法示例。
在下文中一共展示了Uri::routedsegments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call_user_func
// with an underscore can be called via the URI.
if (array_key_exists(strtolower($method), Core::libraries()) || substr($method, 0, 1) == '_') {
Core::error404($uri);
}
// instantiate the controller (and run its constructor)
$class = Core::controller($class);
// Call the remapping function if it's present in the controller
if (method_exists($class, '_remap')) {
call_user_func(array($class, '_remap'));
} else {
if (!method_exists($class, $method)) {
Core::error404($uri);
}
// Call the requested method. Any URI segments present
// (besides the controller/action) will be passed to the method for convenience
call_user_func_array(array($class, $method), array_slice(Uri::routedsegments(), 2));
}
// send final output
Output::display();
}
// ------------------------------------------------------------- Support Functions
function urlpath($url)
{
return str_replace(URL, ROOT, $url);
}
function rmroot($path)
{
return str_replace(ROOT, '', $path);
}
function error($msg)
{
示例2: _set
/**
* SET THE ROUTE
* This function takes an array of URI segments as
* input, and sets the current class/method
**/
private static function _set($segments = false)
{
// we check the segments array
$segments = self::_validate($segments);
if (count($segments) == 0) {
return;
}
self::$_CLS = $segments[0];
// Set the corresponding method.
if (isset($segments[1])) {
self::$_MTD = $segments[1];
} else {
self::$_MTD = $segments[1] = 'index';
}
// Update the routed segments array
// if there's no custom routing this will be the same as Uri::segments();
Uri::routedsegments($segments);
}