本文整理汇总了PHP中Request::getGET方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getGET方法的具体用法?PHP Request::getGET怎么用?PHP Request::getGET使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Request
的用法示例。
在下文中一共展示了Request::getGET方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defaultAction
public function defaultAction()
{
$pageSize = 20;
// 获取参数
$page = Pager::get();
$title = Request::getGET('title');
$status = (int) Request::getGET('status');
// 构建where
$where = array();
$where[] = array('user_id', '=', $this->loginUserInfo['id']);
if (!empty($title)) {
$where[] = array('title', 'LIKE', "%{$title}%");
}
if (!empty($status) && $status != -1) {
$where[] = array('hidden', '=', $status - 1);
}
// 获取数据
$order = array('refresh_at' => 'DESC', 'id' => 'DESC');
$offset = ($page - 1) * $pageSize;
$setList = OjProblemSetInterface::getList(array('where' => $where, 'order' => $order, 'limit' => $pageSize, 'offset' => $offset));
$allCount = OjProblemSetInterface::getCount($where);
foreach ($setList as &$setInfo) {
$problemJson = $setInfo['problem_set'];
$globalIds = (array) json_decode($problemJson, true);
$setInfo['count'] = count($globalIds);
}
// 缓存部分的html
$html = array();
$html['pager'] = $this->view->fetch(array('renderAllCount' => $allCount, 'renderPageSize' => $pageSize, 'renderRadius' => 8), 'widget/pager.php');
// 输出
$this->renderFramework(array('html' => $html, 'setList' => $setList), 'setup/set/list.php');
}
示例2: ajaxAction
public function ajaxAction()
{
// 获取dir参数
$dir = Request::getGET('dir', 'image');
if (!array_key_exists($dir, self::$ALLOWED)) {
echo json_encode(array('error' => 1, 'message' => '参数错误!'));
return;
}
// 获取上传的文件
$field = 'imgFile';
$fileSize = Upload::getFilesize($field);
$tmpName = Upload::getTmpName($field);
$fileExt = Upload::getFileExt($field);
if (empty($fileSize)) {
echo json_encode(array('error' => 1, 'message' => '请上传文件!'));
return;
}
// 校验格式
if (!in_array($fileExt, self::$ALLOWED[$dir])) {
echo json_encode(array('error' => 1, 'message' => '文件格式不支持,无法上传!'));
return;
}
// 保存
$cdnKey = Cdn::uploadLocalFile($tmpName, $this->loginUserInfo['id'], $fileExt);
$url = Cdn::getUrl($cdnKey);
echo json_encode(array('error' => 0, 'url' => $url));
}
示例3: run
public static function run()
{
header('Content-type: text/html; charset=utf-8');
// debug
Debug::p('PHP Begin');
$htmlDebug = Request::getGET('htmldebug');
$ajaxDebug = Request::getGET('ajaxdebug');
if ($htmlDebug == 'on') {
Cookie::set('htmldebug', 1);
}
if ($htmlDebug == 'off') {
Cookie::delete('htmldebug');
}
if ($ajaxDebug == 'on') {
Cookie::set('ajaxdebug', 1);
}
if ($ajaxDebug == 'off') {
Cookie::delete('ajaxdebug');
}
self::parseUrl();
$path = empty(self::$CLASS_DIR) ? PROJECT_PATH . '/controller/' . self::$CLASS_NAME . '.class.php' : PROJECT_PATH . '/controller/' . self::$CLASS_DIR . '/' . self::$CLASS_NAME . '.class.php';
if (!is_file($path)) {
$userAgent = Arr::get('HTTP_USER_AGENT', $_SERVER, '');
throw new FrameworkException("控制器:{$path} 不存在!User Agent: {$userAgent}");
}
require_once $path;
$obj = new self::$CLASS_NAME();
$actionName = self::$ACTION . 'Action';
$obj->{$actionName}();
// debug
Debug::p('PHP End');
if (isset($_COOKIE['htmldebug']) && !self::$IS_AJAX || isset($_COOKIE['ajaxdebug']) && self::$IS_AJAX) {
Debug::show();
}
}
示例4: defaultAction
public function defaultAction()
{
$pageSize = 50;
// 获取参数
$page = Pager::get();
$contestId = (int) Request::getGET('contest-id');
$status = (int) Request::getGET('status', -1);
$contestInfo = OjContestInterface::getById(array('id' => $contestId));
if (empty($contestInfo) || $contestInfo['hidden'] || $contestInfo['type'] != ContestVars::TYPE_APPLY) {
$this->renderError('竞赛不存在,或者竞赛不需要报名!');
}
// 构建where
$where = array();
$where[] = array('contest_id', '=', $contestId);
if ($status != -1) {
$where[] = array('status', '=', $status);
}
// 获取数据
$offset = ($page - 1) * $pageSize;
$applyList = OjContestApplyInterface::getList(array('where' => $where, 'limit' => $pageSize, 'offset' => $offset));
$allCount = OjContestApplyInterface::getCount($where);
// userHash
$userIds = array_unique(array_column($applyList, 'user_id'));
$userHash = UserCommonInterface::getById(array('id' => $userIds));
// 缓存部分的html
$html = array();
$html['pager'] = $this->view->fetch(array('renderAllCount' => $allCount, 'renderPageSize' => $pageSize, 'renderRadius' => 8), 'widget/pager.php');
$this->renderFramework(array('html' => $html, 'applyList' => $applyList, 'contestInfo' => $contestInfo, 'userHash' => $userHash), 'contest/apply_list.php');
}
示例5: defaultAction
public function defaultAction()
{
$pageSize = 50;
$page = Pager::get();
$category = (int) Request::getGET('category', -1);
$title = trim(Request::getGET('title', ''));
$username = trim(Request::getGET('username', ''));
$where = array();
if ($category != -1) {
$where[] = array('category', '=', $category);
}
if (!empty($username)) {
$userInfo = UserCommonInterface::getByLoginName(array('login_name' => $username));
$where[] = array('user_id', '=', Arr::get('id', $userInfo, 0));
}
if (!empty($title)) {
$where[] = array('title', 'LIKE', "%{$title}%");
}
if ($category != -1) {
$order = array('hidden' => 'ASC', 'title' => 'ASC', 'id' => 'DESC');
} else {
$order = array('id' => 'DESC');
}
$offset = ($page - 1) * $pageSize;
$docList = DocInterface::getList(array('where' => $where, 'order' => $order, 'limit' => $pageSize, 'offset' => $offset));
$allCount = empty($docList) ? 0 : DocInterface::getCount($where);
$userIds = array_unique(array_column($docList, 'user_id'));
$userHash = UserCommonInterface::getById(array('id' => $userIds));
// 缓存部分的html
$html = array();
$html['pager'] = $this->view->fetch(array('renderAllCount' => $allCount, 'renderPageSize' => $pageSize, 'renderRadius' => 7), 'widget/pager.php');
$this->renderFramework(array('html' => $html, 'docList' => $docList, 'userHash' => $userHash), 'doc/list.php');
}
示例6: defaultAction
public function defaultAction()
{
// 获取参数
$globalId = (int) Request::getGET('global-id');
$problemId = Request::getGET('problem-id');
$problemInfo = array();
if (!empty($globalId)) {
$problemInfo = OjProblemInterface::getById(array('id' => $globalId));
} else {
if (!empty($problemId)) {
$problemInfo = OjProblemInterface::getDetail(array('remote' => StatusVars::REMOTE_HQU, 'problem_id' => $problemId));
}
}
if (empty($problemInfo)) {
$this->renderError('题目不存在!');
}
// 权限校验
if ($problemInfo['user_id'] != $this->loginUserInfo['id']) {
$this->renderError('你没有权限查看!');
}
if ($problemInfo['remote'] != StatusVars::REMOTE_HQU) {
$this->renderError('你没有权限查看!');
}
$this->renderFramework(array('problemInfo' => $problemInfo), 'setup/problem/detail.php');
}
示例7: defaultAction
public function defaultAction()
{
$pageSize = 15;
$problemId = Request::getGET('problem-id');
$language = (int) Request::getGET('language', -1);
$result = (int) Request::getGET('result', -1);
// 获取id
$maxId = (int) Request::getGET('max-id', -1);
$minId = (int) Request::getGET('min-id', -1);
// 获取用户创建的所有题目
$where = array(array('remote', '=', StatusVars::REMOTE_HQU), array('user_id', '=', $this->loginUserInfo['id']));
$problemList = OjProblemInterface::getList(array('field' => 'problem_id', 'where' => $where));
$problemIds = array_column($problemList, 'problem_id');
// 构建where
$where = array(array('user_id', '=', $this->loginUserInfo['id']), array('solution_id', '=', 0), array('problem_id', 'IN', $problemIds));
if (!empty($problemId)) {
// HQOJ上的题目,problem_code和problem_id相同
$where[] = array('problem_id', '=', $problemId);
}
if ($language != -1) {
$where[] = array('language', '=', $language);
}
if ($result != -1) {
$where[] = array('result', '=', $result);
}
// 获取judgeList
if ($maxId != -1) {
$where[] = array('id', '<=', $maxId);
$judgeList = OjJudgeInterface::getList(array('where' => $where, 'order' => array('id' => 'DESC'), 'limit' => $pageSize));
} else {
if ($minId != -1) {
$where[] = array('id', '>=', $minId);
$judgeList = OjJudgeInterface::getList(array('where' => $where, 'order' => array('id' => 'ASC'), 'limit' => $pageSize));
$judgeList = array_reverse($judgeList, true);
} else {
$judgeList = OjJudgeInterface::getList(array('where' => $where, 'order' => array('id' => 'DESC'), 'limit' => $pageSize));
}
}
// 获取userHash
$userIds = array_unique(array_column($judgeList, 'user_id'));
$userHash = UserCommonInterface::getById(array('id' => $userIds));
// 格式化solution
foreach ($judgeList as &$judgeInfo) {
$text = StatusVars::$RESULT_FORMAT[$judgeInfo['result']];
$class = StatusVars::$RESULT_CLASS[$judgeInfo['result']];
$judgeInfo['result_html'] = sprintf('<span class="%s">%s</span>', $class, $text);
}
// 计算minId, maxId
$minId = $maxId = 0;
if (!empty($judgeList)) {
$judgeIds = array_keys($judgeList);
$maxId = $judgeIds[0];
$minId = end($judgeIds);
}
// 缓存html
$html = array();
$html['pager'] = $this->view->fetch(array('renderMaxId' => $maxId, 'renderMinId' => $minId), 'widget/pager_status.php');
// render
$this->renderFramework(array('userHash' => $userHash, 'judgeList' => $judgeList, 'html' => $html), 'setup/problem/judge_list.php');
}
示例8: defaultAction
public function defaultAction()
{
$pageSize = 20;
// 获取参数
$page = Pager::get();
$status = (int) Request::getGET('status', -1);
$contestId = (int) Request::getGET('contest-id', 0);
$where = array();
$where[] = array('is_diy', '=', 0);
if (!empty($contestId)) {
$where[] = array('contest_id', '=', $contestId);
}
if ($status != -1) {
$where[] = array('status', '=', $status);
}
// 获取数据
$offset = ($page - 1) * $pageSize;
$applyList = OjContestApplyInterface::getList(array('where' => $where, 'limit' => $pageSize, 'offset' => $offset));
$allCount = 0;
$userHash = array();
$contestHash = array();
if (!empty($applyList)) {
$allCount = OjContestApplyInterface::getCount($where);
$userIds = array_column($applyList, 'user_id');
$userHash = UserCommonInterface::getById(array('id' => $userIds));
$contestIds = array_unique(array_column($applyList, 'contest_id'));
$contestHash = OjContestInterface::getById(array('id' => $contestIds));
}
// 缓存部分的html
$html = array();
$html['pager'] = $this->view->fetch(array('renderAllCount' => $allCount, 'renderPageSize' => $pageSize, 'renderRadius' => 8), 'widget/pager.php');
$this->renderFramework(array('html' => $html, 'applyList' => $applyList, 'contestHash' => $contestHash, 'userHash' => $userHash), 'contest/apply_list.php');
}
示例9: iframeSetUserAction
public function iframeSetUserAction()
{
// 获取参数
$globalId = (int) Request::getGET('global-id');
if (empty($globalId)) {
$this->renderError('参数错误!');
}
$this->renderIframe(array(), 'problem/iframe/set_user.php');
}
示例10: defaultAction
public function defaultAction()
{
$globalId = Request::getGET('global-id');
$problemInfo = OjProblemInterface::getById(array('id' => $globalId));
if (empty($problemInfo) || !$problemInfo['hidden'] || $problemInfo['user_id'] != $this->loginUserInfo['id']) {
$this->renderError('你没有操作权限!');
}
$this->renderFramework(array('problemInfo' => $problemInfo), 'setup/problem/edit.php');
}
示例11: defaultAction
public function defaultAction()
{
$globalId = Request::getGET('global-id');
$problemInfo = OjProblemInterface::getById(array('id' => $globalId));
if (empty($problemInfo)) {
$this->renderError('题目不存在!');
}
$this->renderFramework(array('problemInfo' => $problemInfo), 'problem/edit.php');
}
示例12: iframeChangeAction
public function iframeChangeAction()
{
$docId = (int) Request::getGET('doc-id');
$docInfo = DocInterface::getById(array('id' => $docId));
if (empty($docInfo)) {
$this->renderError('文章不存在!');
}
$userInfo = UserCommonInterface::getById(array('id' => $docInfo['user_id']));
$this->renderIframe(array('userInfo' => $userInfo, 'docInfo' => $docInfo), 'doc/iframe/change.php');
}
示例13: iframeRemoveAction
public function iframeRemoveAction()
{
$managerId = Request::getGET('manager-id', 0);
$managerInfo = RootManagerInterface::getById(array('id' => $managerId));
if (empty($managerInfo)) {
$this->renderIframeError('管理员不存在!');
}
$userInfo = UserCommonInterface::getById(array('id' => $managerInfo['user_id']));
$this->renderIframe(array('userInfo' => $userInfo), 'manager/iframe/remove_path.php');
}
示例14: iframeShowAction
public function iframeShowAction()
{
$judgeId = (int) Request::getGET('judge-id');
// 获取judgeInfo
$judgeInfo = OjJudgeInterface::getRow(array('id' => $judgeId));
if (empty($judgeInfo)) {
$this->renderError();
}
$this->renderIframe(array('judgeInfo' => $judgeInfo), 'problem/iframe/judge_log.php');
}
示例15: defaultAction
public function defaultAction()
{
$docId = (int) Request::getGET('doc-id');
$docInfo = DocInterface::getById(array('id' => $docId));
if (empty($docInfo)) {
$this->renderError();
}
$userInfo = UserCommonInterface::getById(array('id' => $docInfo['user_id']));
$this->renderFramework(array('docInfo' => $docInfo, 'userInfo' => $userInfo), 'doc/detail.php');
}