本文整理汇总了PHP中Slim\Http\Request::isGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::isGet方法的具体用法?PHP Request::isGet怎么用?PHP Request::isGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Http\Request
的用法示例。
在下文中一共展示了Request::isGet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
public function __invoke(Request $req, Response $res, callable $next)
{
$map = function ($value) {
return ['value' => $value, 'label' => $value];
};
if ($req->isGet()) {
$this->view['tpe_survey'] = ['already_using_tpe' => self::$alreadyUsingTpe, 'knowledge_levels' => array_map($map, self::$knowledgeLevels), 'assets_in_use' => array_map($map, self::$assetsInUse), 'software_in_use' => self::$softwareInUse, 'use_case' => self::$useCase];
}
return $next($req, $res);
}
示例2: authorizeSkillRoute
public function authorizeSkillRoute(Request $request, Response $response, callable $next)
{
// Authorize portfolio middleware
$args = $request->getAttribute('routeInfo')[2];
if (!$args || $request->isXhr() && $request->isGet()) {
return $next($request, $response);
}
$count = $this->data(Models\MemberSkills::class)->count(['member_skill_id' => (int) $args['id'], 'user_id' => $this->session->get('user_id')]);
if ($count < 1) {
$this->flash->addMessage('warning', 'Permission denied.');
return $response->withRedirect($this->router->pathFor('membership-account'));
}
return $next($request, $response);
}
示例3: isAcceptable
/**
* @param \Slim\Http\Request $request
* @return bool
*/
private function isAcceptable(Request $request)
{
$args = $request->getAttribute('routeInfo')[2];
return !$args || $request->isXhr() && $request->isGet();
}
示例4: isGet
protected function isGet()
{
return $this->request->isGet();
}
示例5: video
/**
* Dislay information about the video.
*
* @param Request $request PSR-7 request
* @param Response $response PSR-7 response
*
* @return Response HTTP response
*/
public function video(Request $request, Response $response)
{
$params = $request->getQueryParams();
$this->config = Config::getInstance();
if (isset($params['url'])) {
if (isset($params['audio'])) {
try {
$url = $this->download->getURL($params['url'], 'mp3[protocol^=http]');
return $response->withRedirect($url);
} catch (\Exception $e) {
$response = $response->withHeader('Content-Disposition', 'attachment; filename="' . $this->download->getAudioFilename($params['url'], 'bestaudio/best') . '"');
$response = $response->withHeader('Content-Type', 'audio/mpeg');
if ($request->isGet()) {
$process = $this->download->getAudioStream($params['url'], 'bestaudio/best');
$response = $response->withBody(new Stream($process));
}
return $response;
}
} else {
$video = $this->download->getJSON($params['url']);
if ($this->container instanceof Container) {
$this->container->view->render($response, 'video.tpl', ['video' => $video, 'class' => 'video', 'title' => $video->title, 'description' => 'Download "' . $video->title . '" from ' . $video->extractor_key]);
}
}
} else {
return $response->withRedirect($this->container->get('router')->pathFor('index'));
}
}