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