当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::location方法代码示例

本文整理汇总了PHP中Cake\Network\Response::location方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::location方法的具体用法?PHP Response::location怎么用?PHP Response::location使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Network\Response的用法示例。


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

示例1: beforeRedirect

 /**
  * Manage redirect for specific buttons that posted.
  *
  * @param Event $event
  * @param array|string $url
  * @param Response $response
  * @return bool
  */
 public function beforeRedirect(Event $event, $url, Response $response)
 {
     if ($this->request->param('prefix') == 'admin') {
         if (isset($this->request->data['apply'])) {
             $response->location(Router::url($this->request->here(false), true));
         }
     }
     return true;
 }
开发者ID:mohammadsaleh,项目名称:spider,代码行数:17,代码来源:SpiderController.php

示例2: _verifyCode

 /**
  * Verify one-time code. If code not provided - redirect to verifyAction. If code provided and is not valid -
  * set flash message and redirect to verifyAction. Otherwise - return true.
  *
  * @param string $secret user's secret
  * @param string $code one-time code
  * @param Response $response response instance
  * @var AuthComponent $Auth used Auth component
  * @return bool
  * @throws Exception
  */
 protected function _verifyCode($secret, $code, Response $response)
 {
     $Auth = $this->_registry->getController()->Auth;
     if (!$Auth instanceof AuthComponent) {
         throw new Exception('TwoFactorAuth.Auth component has to be used for authentication.');
     }
     $verifyAction = Router::url($Auth->config('verifyAction'), true);
     if ($code === null) {
         $response->location($verifyAction);
         return false;
     }
     if (!$Auth->verifyCode($secret, $code)) {
         $Auth->flash(__d('TwoFactorAuth', 'Invalid two-step verification code.'));
         $response->location($verifyAction);
         return false;
     }
     return true;
 }
开发者ID:andrej-griniuk,项目名称:cakephp-two-factor-auth,代码行数:29,代码来源:FormAuthenticate.php

示例3: testLocation

 /**
  * Test the location method.
  *
  * @return void
  */
 public function testLocation()
 {
     $response = new Response();
     $this->assertNull($response->location(), 'No header should be set.');
     $this->assertNull($response->location('http://example.org'), 'Setting a location should return null');
     $this->assertEquals('http://example.org', $response->location(), 'Reading a location should return the value.');
 }
开发者ID:rashmi,项目名称:newrepo,代码行数:12,代码来源:ResponseTest.php

示例4: unauthenticated

 /**
  * Handles unauthenticated access attempts. Will automatically forward to the
  * requested provider's authorization URL to let the user grant access to the
  * application.
  *
  * @param \Cake\Network\Request $request Request object.
  * @param \Cake\Network\Response $response Response object.
  * @return \Cake\Network\Response|null
  */
 public function unauthenticated(Request $request, Response $response)
 {
     $provider = $this->provider($request);
     if (empty($provider) || !empty($request->query['code'])) {
         return null;
     }
     if ($this->config('options.state')) {
         $request->session()->write('oauth2state', $provider->getState());
     }
     $response->location($provider->getAuthorizationUrl());
     return $response;
 }
开发者ID:GF-TIC,项目名称:users,代码行数:21,代码来源:SocialAuthenticate.php


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