本文整理匯總了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'];
}