本文整理汇总了PHP中CRequest::getAction方法的典型用法代码示例。如果您正苦于以下问题:PHP CRequest::getAction方法的具体用法?PHP CRequest::getAction怎么用?PHP CRequest::getAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRequest
的用法示例。
在下文中一共展示了CRequest::getAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkRight
/**
* 是否有权限
*/
public static function checkRight($thisRoute = null)
{
// 用户资源
$userData = CSession::get('user');
if ($userData['groupId'] == 1) {
return true;
}
$userRightList = isset($userData['rightAll']) ? $userData['rightAll'] : array();
// 附加公共资源
array_push($userRightList, 'system@welcome');
array_push($userRightList, 'system@navList');
array_push($userRightList, 'system@addNav');
array_push($userRightList, 'system@addNavHandle');
array_push($userRightList, 'system@ajaxAddNav');
array_push($userRightList, 'system@editNav');
array_push($userRightList, 'system@editNavHandle');
array_push($userRightList, 'system@delNav');
array_push($userRightList, 'system@changeMyPassword');
array_push($userRightList, 'system@changeMyPassHandle');
array_push($userRightList, 'adminRole@messageCenterForClient');
array_push($userRightList, 'system@seeHelp');
// 转小写
foreach ($userRightList as $key => $val) {
$userRightList[$key] = strtolower($val);
}
// 获取当前请求的路由
if ($thisRoute == null) {
$route = CRequest::getController() . '@' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction());
} else {
$route = $thisRoute;
}
return in_array(strtolower($route), $userRightList);
}
示例2: display
public function display($templateName = '', $isCache = false, $num = '')
{
if (empty($templateName)) {
$templateName = CRequest::getController() . '/' . str_replace(CConfig::getInstance()->load('ACTION_PREFIX'), '', CRequest::getAction());
}
parent::display($templateName, $isCache, $num);
}
示例3: setInitData
/**
* 设置基础数据
*/
public static function setInitData($viewObject)
{
$prefix = CConfig::getInstance()->load('ACTION_PREFIX');
$viewObject->assign('thisUrl', urlencode(CRequest::getUrl()));
$viewObject->assign('base64Url', CEncrypt::safe_b64encode(CRequest::getUrl()));
$viewObject->assign('controller', CRequest::getController());
$viewObject->assign('action', CRequest::getAction());
$viewObject->assign('actionPre', $prefix);
$viewObject->assign('ip', CRequest::getIp());
$viewObject->assign('module', CRequest::getModule());
$viewObject->assign('time', time());
$viewObject->assign('sessionID', session_id());
$viewObject->assign('path', CRequest::getPath());
$viewObject->assign('staticUrl', CConfig::getInstance('site')->load('staticUrl'));
$viewObject->assign('uploadStaticUrl', CConfig::getInstance('site')->load('uploadStaticUrl'));
$viewObject->assign('siteName', CConfig::getInstance('site')->load('siteName'));
}