當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。