本文整理汇总了PHP中controller::route方法的典型用法代码示例。如果您正苦于以下问题:PHP controller::route方法的具体用法?PHP controller::route怎么用?PHP controller::route使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类controller
的用法示例。
在下文中一共展示了controller::route方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: call
public static function call($route, $params = null)
{
self::$route = $route;
self::$params = $params;
if (!class_exists(self::$route[0] . '_controller')) {
self::$route[0] = config::get_config('app_config')['default_controller'] . '_controller';
messages::set_message('00', 'alert-danger');
} else {
self::$route[0] = self::$route[0] . '_controller';
}
if (!isset(self::$route[1])) {
self::$route[1] = config::get_config('app_config')['default_action'];
}
if (method_exists(self::$route[0], self::$route[1])) {
self::$route[1] = self::$route[1];
} else {
self::$route[1] = config::get_config('app_config')['default_action'];
messages::set_message('01', 'alert-danger');
}
call_user_func_array(self::$route, self::$params);
}
示例2: _destroy
global $_sess_db;
$access = time();
$id = mysql_real_escape_string($id);
$access = mysql_real_escape_string($access);
$data = mysql_real_escape_string($data);
$sql = "REPLACE INTO sessions VALUES ('{$id}', '{$access}', '{$data}')";
return mysql_query($sql, $_sess_db);
}
function _destroy($id)
{
global $_sess_db;
$id = mysql_real_escape_string($id);
$sql = "DELETE FROM sessions WHERE id = '{$id}'";
return mysql_query($sql, $_sess_db);
}
function _clean($max)
{
global $_sess_db;
$old = time() - $max;
$old = mysql_real_escape_string($old);
$sql = "DELETE FROM sessions WHERE access < '{$old}'";
return mysql_query($sql, $_sess_db);
}
// Start the session ...
session_start();
// ... and assign some values. (The session will be created if not exists).
$_SESSION['name'] = 'avedo';
$_SESSION['surname'] = 'felipe';
$controller = new controller();
$controller->route();