• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Req类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Req的典型用法代码示例。如果您正苦于以下问题:PHP Req类的具体用法?PHP Req怎么用?PHP Req使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Req类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: photo_urls

 public function photo_urls(Req $req, Res $res, $args)
 {
     $params = $req->getQueryParams();
     $jd_id = $args['jd_id'] ?? '0';
     $params['jd_id'] = $jd_id;
     $m_p = new \App\Model\Photo();
     $result = $m_p->get_urls($params);
     return $res->output($result);
 }
开发者ID:leilt331,项目名称:rest_api,代码行数:9,代码来源:Jingdians.php


示例2: authorize

 public function authorize(Req $req, Res $res, $args)
 {
     $grant_type = $req->getInput('grant_type');
     $client_id = $req->getServerParam('PHP_AUTH_USER');
     $client_secret = $req->getServerParam('PHP_AUTH_PW');
     $oauth = new Oauth();
     $result = $oauth->get_token($client_id, $client_secret, $grant_type);
     return $res->authorize_output($result);
 }
开发者ID:leilt331,项目名称:rest_api,代码行数:9,代码来源:Token.php


示例3: main

 public function main()
 {
     $this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
     $cookie = Lib::cookie();
     $identifier = $cookie->get(Lib::hash(Config::$userkey));
     $user = Lib::table('user');
     $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
     $this->set('user', $user);
     $this->set('isLoggedIn', $isLoggedIn);
     $this->js[] = $isLoggedIn ? 'inbox' : 'login';
     if ($isLoggedIn) {
         array_shift($this->js);
         $id = Req::get('id');
         if (empty($id)) {
             Lib::redirect('index');
         }
         $report = Lib::table('report');
         if (!$report->load($id)) {
             $this->template = 'no-report';
             return;
         }
         $report->init();
         $assignees = Lib::model('user')->getProjectAssignees($report->project_id);
         $projectTable = Lib::table('project');
         $projectTable->load($report->project_id);
         $this->set('report', $report);
         $this->set('assignees', $assignees);
         $this->set('project', $projectTable);
     }
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:30,代码来源:report.php


示例4: show

 function show()
 {
     global $page, $db, $user, $fs, $proj;
     $page->setTitle($fs->prefs['page_title'] . L('reports'));
     $events = array(1 => L('taskopened'), 13 => L('taskreopened'), 2 => L('taskclosed'), 3 => L('taskedited'), 14 => L('assignmentchanged'), 29 => L('events.useraddedtoassignees'), 4 => L('commentadded'), 5 => L('commentedited'), 6 => L('commentdeleted'), 7 => L('attachmentadded'), 8 => L('attachmentdeleted'), 11 => L('relatedadded'), 12 => L('relateddeleted'), 9 => L('notificationadded'), 10 => L('notificationdeleted'), 17 => L('reminderadded'), 18 => L('reminderdeleted'));
     $user_events = array(30 => L('created'), 31 => L('deleted'));
     $page->assign('events', $events);
     $page->assign('user_events', $user_events);
     $sort = strtoupper(Get::enum('sort', array('desc', 'asc')));
     $where = array();
     $params = array();
     $orderby = '';
     switch (Get::val('order')) {
         case 'type':
             $orderby = "h.event_type {$sort}, h.event_date {$sort}";
             break;
         case 'user':
             $orderby = "user_id {$sort}, h.event_date {$sort}";
             break;
         case 'date':
         default:
             $orderby = "h.event_date {$sort}, h.event_type {$sort}";
     }
     foreach (Get::val('events', array()) as $eventtype) {
         $where[] = 'h.event_type = ?';
         $params[] = $eventtype;
     }
     $where = '(' . implode(' OR ', $where) . ')';
     if ($proj->id) {
         $where = $where . 'AND (t.project_id = ?  OR h.event_type > 29) ';
         $params[] = $proj->id;
     }
     if (($fromdate = Req::val('fromdate')) || Req::val('todate')) {
         $where .= ' AND ';
         $todate = Req::val('todate');
         if ($fromdate) {
             $where .= ' h.event_date > ?';
             $params[] = Flyspray::strtotime($fromdate) + 0;
         }
         if ($todate && $fromdate) {
             $where .= ' AND h.event_date < ?';
             $params[] = Flyspray::strtotime($todate) + 86400;
         } else {
             if ($todate) {
                 $where .= ' h.event_date < ?';
                 $params[] = Flyspray::strtotime($todate) + 86400;
             }
         }
     }
     $histories = array();
     if (count(Get::val('events'))) {
         if (Get::num('event_number') > 0) {
             $db->setLimit(Get::num('event_number'));
         }
         $histories = $db->x->getAll("SELECT h.*, t.*, p.project_prefix\n                                             FROM {history} h\n                                        LEFT JOIN {tasks} t ON h.task_id = t.task_id\n                                        LEFT JOIN {projects} p ON t.project_id = p.project_id\n                                            WHERE {$where}\n                                         ORDER BY {$orderby}", null, $params);
     }
     $page->assign('histories', $histories);
     $page->assign('sort', $sort);
     $page->pushTpl('reports.tpl');
 }
开发者ID:negram,项目名称:flyspray,代码行数:60,代码来源:reports.php


示例5: saveAssignees

 public function saveAssignees()
 {
     $keys = array('project', 'setting');
     if (!Req::haspost($keys)) {
         return $this->fail('Insufficient data.');
     }
     $identifier = Lib::cookie(Lib::hash(Config::$userkey));
     $user = Lib::table('user');
     $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
     if (!$isLoggedIn || $user->role != USER_ROLE_ADMIN) {
         return $this->fail('You are not authorized.');
     }
     $project = Req::post('project');
     $setting = json_decode(Req::post('setting'));
     $projectTable = Lib::table('project');
     if ($project !== 'all' && $project !== '-1' && !$projectTable->load(array('name' => $project))) {
         return $this->fail('No such project.');
     }
     if ($project !== 'all') {
         $projectAssignee = Lib::table('project_assignee');
         $projectAssignee->load(array('user_id' => $setting->id, 'project_id' => $projectTable->id));
         if ($setting->value) {
             $projectAssignee->store();
         } else {
             $projectAssignee->delete();
         }
     }
     return $this->success();
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:29,代码来源:project.php


示例6: set_id

 /**
  * 根据 IP、当前小时、对应的路由、arg 参数、key 限制调用频率
  *
  * @param Req $req HTTP 请求对象
  */
 protected function set_id(Req $req)
 {
     $ip = $req->getServerParam('REMOTE_ADDR');
     $id = $ip . ':' . date('H');
     $route = $req->getAttribute('route');
     if ($route) {
         $id .= ':' . $route->getIdentifier();
         if (!empty($this->opts['arg'])) {
             $id .= ':' . $route->getArgument($this->opts['arg']);
         }
     }
     if (!empty($this->opts['key'])) {
         $id .= ':' . $this->opts['key'];
     }
     $this->id = $id;
 }
开发者ID:leilt331,项目名称:rest_api,代码行数:21,代码来源:Limiter.php


示例7: execute

 public function execute()
 {
     $api = Lib::api('admin', array('response' => 'return', 'format' => 'php'));
     $type = Req::get('type');
     if (!is_callable(array($api, $type))) {
         return Lib::redirect('error');
     }
     $result = $api->{$type}();
     $options = array('view' => 'admin');
     $ref = Req::post('ref');
     if (!$result['state']) {
         if (!empty($ref)) {
             $options['ref'] = $ref;
         }
     } else {
         $segments = explode('/', base64_decode(urldecode($ref)));
         $base = array_shift($segments);
         $type = array_shift($segments);
         $subtype = array_shift($segments);
         if (!empty($type)) {
             $options['type'] = $type;
         }
         if (!empty($subtype)) {
             $options['subtype'] = $subtype;
         }
     }
     Lib::redirect('admin', $options);
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:28,代码来源:admin.php


示例8: before

 public function before($obj = null)
 {
     // 推荐商户设置   add by t-btei 2015/05/04
     $companyId = Req::args('companyId');
     if (isset($companyId)) {
         // 保存推荐ID
         setcookie('company_affiliate_uid', $companyId);
     }
     //测试平板或者手机端主题
     $clientType = Chips::clientType();
     if ($clientType == 'tablet' || $clientType == 'mobile') {
         $config_path = APP_CODE_ROOT . 'config/config.php';
         $config = (require $config_path);
         if (isset($config['themes_mobile'])) {
             $themes_mobile = Tiny::app()->setTheme($config['themes_mobile']);
         } else {
             Tiny::app()->setTheme("default");
         }
     }
     $config = Config::getInstance();
     $site = $config->get('globals');
     $other = $config->get('other');
     $currency_symbol = isset($other['other_currency_symbol']) ? $other['other_currency_symbol'] : '¥';
     $site_logo = isset($site['site_logo']) && $site['site_logo'] != '' ? $site['site_logo'] : 'static/images/logo.png';
     $site_qr = isset($site['site_qr']) && $site['site_qr'] != '' ? $site['site_qr'] : 'static/images/qr-app.png';
     $site_name = isset($site['site_name']) ? $site['site_name'] : 'TinyShop商城';
     $site_icp = isset($site['site_icp']) ? $site['site_icp'] : '鲁ICP备00000100号';
     $obj->assign('currency_symbol', $currency_symbol);
     $obj->assign('site_logo', $site_logo);
     $obj->assign('site_qr', $site_qr);
     $obj->assign('site_name', $site_name);
     $obj->assign('site_icp', $site_icp);
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:33,代码来源:ControllerExt.php


示例9: env

 public static function env($checkget = true)
 {
     if ($checkget && Req::hasget('environment')) {
         return Req::get('environment');
     }
     $serverName = $_SERVER['SERVER_NAME'];
     return isset(Config::$baseurl[$serverName]) ? Config::$baseurl[$serverName] : 'production';
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:8,代码来源:config.php


示例10: main

 public function main()
 {
     $filterProject = Req::get('project');
     if (empty($filterProject)) {
         $this->template = 'empty-project';
         return;
     }
     $projectTable = Lib::table('project');
     if (!$projectTable->load(array('name' => $filterProject))) {
         $this->set('name', $filterProject);
         $this->template = 'new-project';
         return;
     }
     $this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
     $cookie = Lib::cookie();
     $identifier = $cookie->get(Lib::hash(Config::$userkey));
     $user = Lib::table('user');
     $isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
     $this->set('user', $user);
     $this->set('filterProject', $filterProject);
     $this->set('filterSettingsProject', $filterProject);
     $this->set('isLoggedIn', $isLoggedIn);
     if (!$isLoggedIn) {
         $this->js[] = 'login';
     }
     if ($isLoggedIn) {
         $this->js[] = 'inbox';
         $this->js[] = 'settings';
         array_shift($this->js);
         $userModel = Lib::model('user');
         $assignees = $userModel->getProjectAssignees($projectTable->id);
         $users = $userModel->getUsers();
         $filterState = $cookie->get('filter-state', 'pending');
         $filterAssignee = $cookie->get('filter-assignee', empty($assignees[$user->id]) ? 'all' : $user->id);
         $filterSort = $cookie->get('filter-sort', 'asc');
         $reportModel = Lib::model('report');
         $reports = $reportModel->getItems(array('state' => constant('STATE_' . strtoupper($filterState)), 'assignee_id' => $filterAssignee, 'order' => 'date', 'direction' => $filterSort, 'project_id' => $projectTable->id));
         $userSettingsTable = Lib::table('user_settings');
         if (!$userSettingsTable->load(array('user_id' => $user->id, 'project_id' => $projectTable->id))) {
             $userSettingsTable->load(array('user_id' => $user->id, 'project_id' => 0));
         }
         $userSettings = $userSettingsTable->getData();
         if ($userSettings['color'] !== 'cyan' && $userSettings['color'] !== 'custom') {
             $this->css[] = 'theme-' . str_replace(' ', '', $userSettings['color']);
         }
         $categories = Lib::model('category')->getCategories(['projectid' => $projectTable->id]);
         $this->set('filterState', $filterState);
         $this->set('filterAssignee', $filterAssignee);
         $this->set('filterSort', $filterSort);
         $this->set('reports', $reports);
         $this->set('assignees', $assignees);
         $this->set('userSettings', $userSettings);
         $this->set('users', $users);
         $this->set('projectTable', $projectTable);
         $this->set('categories', $categories);
     }
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:57,代码来源:embed.php


示例11: decode

 public function decode($segments)
 {
     foreach ($segments as $index => $value) {
         if (empty($value) || !isset($this->segments[$index])) {
             continue;
         }
         Req::set('GET', $this->segments[$index], $value);
     }
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:9,代码来源:router.php


示例12: decode

 public function decode($segments = array())
 {
     $total = count($segments);
     foreach ($segments as $index => $value) {
         if (!isset($this->segments[$index])) {
             continue;
         }
         Req::set('GET', $this->segments[$index], $value);
     }
 }
开发者ID:jasonrey,项目名称:lab-page,代码行数:10,代码来源:router.php


示例13: decode

 public function decode($segments)
 {
     if (count($segments) >= 3) {
         $view = array_shift($segments);
         $api = array_shift($segments);
         $action = array_shift($segments);
         Req::set('GET', 'api', $api);
         Req::set('GET', 'action', $action);
     }
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:10,代码来源:api.php


示例14: nextReq

 public function nextReq()
 {
     $req = \Req::orderBy('req', 'DESC')->first(array('req'));
     if (isset($req)) {
         $req->req++;
         return $req->req;
     } else {
         return 1;
     }
 }
开发者ID:armandolazarte,项目名称:gia,代码行数:10,代码来源:Consecutivo.php


示例15: env

 public static function env()
 {
     if (Req::hasget('development')) {
         Lib::cookie()->set('development', Req::get('development'));
     }
     if (Lib::cookie()->get('development')) {
         return 'development';
     }
     return self::$env;
 }
开发者ID:jasonrey,项目名称:lab-page,代码行数:10,代码来源:config.php


示例16: create

 public function create($req_id)
 {
     $req = Req::find($req_id);
     $unidades = Unidad::all();
     $data['req'] = $req;
     foreach ($unidades as $unidad) {
         $arr_unidades[$unidad->tipo][$unidad->unidad] = $unidad->unidad;
     }
     $data['unidades'] = $arr_unidades;
     return View::make('reqs.formArticulo')->with($data);
 }
开发者ID:armandolazarte,项目名称:gia,代码行数:11,代码来源:ArticulosController.php


示例17: __invoke

 public function __invoke(Req $req, Res $res, callable $next)
 {
     $request_uri = $req->getServerParam('REQUEST_URI');
     if (strpos($request_uri, '/token') !== 0) {
         // 获取 token 链接无需验证权限
         $route = $req->getAttribute('route');
         if (!$route) {
             return $next($req, $res);
         }
         $action = ltrim($route->getCallable(), 'App\\Action\\');
         $this->container->get('db');
         $m_o = new \App\Model\Oauth();
         $token = $req->getAccessToken();
         $result = $m_o->valid_token($token, $action, $req);
         if ($result[0] !== 0) {
             return $res->output($result);
         }
     }
     return $next($req, $res);
 }
开发者ID:leilt331,项目名称:rest_api,代码行数:20,代码来源:Oauth.php


示例18: form

 public function form()
 {
     $ref = Req::get('ref');
     $this->set('ref', $ref);
     $model = Lib::model('admin');
     if (!$model->hasAdmins()) {
         $this->template = 'formcreate';
         return;
     }
     $this->template = 'form';
 }
开发者ID:jasonrey,项目名称:project-test-report,代码行数:11,代码来源:admin.php


示例19: getViewPath

 /**
  * 取得视图路径
  * 
  * @access public
  * @return String
  */
 public function getViewPath()
 {
     if ($this->viewPath === null) {
         if (!is_null(Req::args($this->viewParam))) {
             $this->resolveView(Req::args($this->viewParam));
         } else {
             $this->viewPath = strtolower($this->getController()->id) . DIRECTORY_SEPARATOR . strtr($this->id, '.', '/');
         }
     }
     return $this->viewPath;
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:17,代码来源:erroraction_class.php


示例20: show

 public function show($id)
 {
     $req = Req::find($id);
     $articulos = Articulo::whereReqId($id)->get();
     $data['req'] = $req;
     if (isset($articulos)) {
         $data['articulos'] = $articulos;
     } else {
         $data['articulos'] = array();
     }
     return View::make('reqs.infoRequisicion')->with($data);
 }
开发者ID:armandolazarte,项目名称:gia,代码行数:12,代码来源:RequisicionController.php



注:本文中的Req类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Request类代码示例发布时间:2022-05-23
下一篇:
PHP Repository类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap