本文整理汇总了PHP中io::route方法的典型用法代码示例。如果您正苦于以下问题:PHP io::route方法的具体用法?PHP io::route怎么用?PHP io::route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io
的用法示例。
在下文中一共展示了io::route方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: routing
public function routing()
{
/*
* You can echo HTML and other information directly from models or controllers
* however it is usually better to create views for displaying model data.
*/
// Session tracking
io::library('session');
// HTML Header
echo '<h2>Routing Information</h2>';
// Explain a little bit
echo '<p>This method may be useful during development or even within your application. It provides easy access to important information related to routing, like which controller and action were routed. It also conveniently provides access to $_GET, $_POST, $_SESSION, $_COOKIE and parameters passed to Ornithopter during normal routing... </p>';
echo '<blockquote>Accessible by calling <strong class="io">io::route()</strong> within Ornithopter.io</blockquote>';
// Access the internals of Ornithopter.io easily
var_dump(io::route());
}
示例2: nav
/**
* Returns a string if controller / action is matched.
*
* @return mixed
*/
public static function nav($path, $str)
{
// Check if the path is an alternative route
if (\io::route()['controller'] == $path) {
// Return the provided string
return $str;
}
// Check if the path equals the controller action
if ($path == \io::route()['controller'] . '/' . \io::route()['action']) {
// Return the provided string
return $str;
}
// Check if the path is equal to the REQUEST_URI
if ($_SERVER['REQUEST_URI'] == $path) {
// Return the provided string
return $str;
}
// Does not match
return false;
}
示例3: has
/**
* Checks if a $_GET variable exists.
*
* @param string
*
* @return bool
*/
public static function has($var)
{
// Return $var existance as boolean
return isset(io::route()['get'][$var]);
}
示例4: querystring
/**
* Get the query string.
*
* @return string
*/
public static function querystring()
{
// Return the Query String
return \io::route()['query'];
}