當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Session::start方法代碼示例

本文整理匯總了PHP中Session::start方法的典型用法代碼示例。如果您正苦於以下問題:PHP Session::start方法的具體用法?PHP Session::start怎麽用?PHP Session::start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Session的用法示例。


在下文中一共展示了Session::start方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 /**
  * Do not call directly. Use Session::getNamespace().
  */
 private function start()
 {
     if ($this->meta === FALSE) {
         $this->session->start();
         $this->data =& $_SESSION['__NF']['DATA'][$this->name];
         $this->meta =& $_SESSION['__NF']['META'][$this->name];
     }
 }
開發者ID:riskatlas,項目名稱:micka,代碼行數:11,代碼來源:SessionSection.php

示例2: prepareForTests

 protected function prepareForTests()
 {
     parent::prepareForTests();
     Route::enableFilters();
     $this->current_realm = Config::get('app.url');
     $user = User::where('identifier', '=', 'sebastian.marcet')->first();
     $this->be($user);
     Session::start();
     $scope = $this->getScopes();
     $this->client_id = 'Jiz87D8/Vcvr6fvQbH4HyNgwTlfSyQ3x.openstack.client';
     $this->client_secret = 'ITc/6Y5N7kOtGKhg';
     $params = array('client_id' => $this->client_id, 'redirect_uri' => 'https://www.test.com/oauth2', 'response_type' => OAuth2Protocol::OAuth2Protocol_ResponseType_Code, 'scope' => implode(' ', $scope), OAuth2Protocol::OAuth2Protocol_AccessType => OAuth2Protocol::OAuth2Protocol_AccessType_Offline);
     Session::set("openid.authorization.response", IAuthService::AuthorizationResponse_AllowOnce);
     $response = $this->action("POST", "OAuth2ProviderController@authorize", $params, array(), array(), array());
     $status = $response->getStatusCode();
     $url = $response->getTargetUrl();
     $content = $response->getContent();
     $comps = @parse_url($url);
     $query = $comps['query'];
     $output = array();
     parse_str($query, $output);
     $params = array('code' => $output['code'], 'redirect_uri' => 'https://www.test.com/oauth2', 'grant_type' => OAuth2Protocol::OAuth2Protocol_GrantType_AuthCode);
     $response = $this->action("POST", "OAuth2ProviderController@token", $params, array(), array(), array("HTTP_Authorization" => " Basic " . base64_encode($this->client_id . ':' . $this->client_secret)));
     $status = $response->getStatusCode();
     $this->assertResponseStatus(200);
     $content = $response->getContent();
     $response = json_decode($content);
     $access_token = $response->access_token;
     $refresh_token = $response->refresh_token;
     $this->access_token = $access_token;
 }
開發者ID:smarcet,項目名稱:openstackid,代碼行數:31,代碼來源:OAuth2ProtectedApiTest.php

示例3: admin_logged

 public static function admin_logged()
 {
     Session::start();
     if (Session::get('user') === null) {
         Tools::redirect('/admin/login');
     }
 }
開發者ID:kranack,項目名稱:frmwrk,代碼行數:7,代碼來源:Tools.php

示例4: testDeleteDeveloper

 public function testDeleteDeveloper()
 {
     Session::start();
     $response = $this->call('DELETE', '/developer/2', ['_token' => csrf_token()]);
     $this->assertEquals(302, $response->getStatusCode());
     $this->notSeeInDatabase('companies', ['deleted_at' => null, 'id' => 1]);
 }
開發者ID:figura4,項目名稱:c64,代碼行數:7,代碼來源:GameTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     Session::start();
     $this->app->instance('middleware.disable', true);
     $this->mock = $this->mock('App\\Interfaces\\ProductInterface');
 }
開發者ID:Johca,項目名稱:Order-Portal,代碼行數:7,代碼來源:ProductControllerTest.php

示例6: iqWrapper

 static function iqWrapper($xml = false, $to = false, $type = false, $id = false)
 {
     $session = \Session::start();
     $dom = new \DOMDocument('1.0', 'UTF-8');
     $iq = $dom->createElementNS('jabber:client', 'iq');
     $dom->appendChild($iq);
     if ($to != false) {
         $iq->setAttribute('to', $to);
     }
     if ($type != false) {
         $iq->setAttribute('type', $type);
     }
     global $language;
     if ($id == false) {
         $id = $session->get('id');
     }
     $iq->setAttribute('id', $id);
     if (isset($language)) {
         $iq->setAttribute('xml:lang', $language);
     }
     if (isset($session->user)) {
         $iq->setAttribute('from', $session->get('username') . '@' . $session->get('host') . '/' . $session->get('resource'));
     }
     if ($xml != false) {
         if (is_string($xml)) {
             $f = $dom->createDocumentFragment();
             $f->appendXML($xml);
             $iq->appendChild($f);
         } else {
             $xml = $dom->importNode($xml, true);
             $iq->appendChild($xml);
         }
     }
     return $dom->saveXML($dom->documentElement);
 }
開發者ID:movim,項目名稱:moxl,代碼行數:35,代碼來源:API.php

示例7: testSetExpiration

 /**
  * Test expiration of namespaces and namespace variables.
  * @return void
  */
 public function testSetExpiration()
 {
     // try to expire whole namespace
     $s = $this->session->getNamespace('expire');
     $s->a = 'apple';
     $s->p = 'pear';
     $s['o'] = 'orange';
     $s->setExpiration('+ 5 seconds');
     $this->session->close();
     sleep(6);
     $this->session->start();
     $s = $this->session->getNamespace('expire');
     $result = $this->serialize($s->getIterator());
     $this->assertEquals('', $result, 'iteration over named Session namespace failed');
     // try to expire only 1 of the keys
     $s = $this->session->getNamespace('expireSingle');
     $s->setExpiration(5, 'g');
     $s->g = 'guava';
     $s->p = 'plum';
     $this->session->close();
     sleep(6);
     $this->session->start();
     $s = $this->session->getNamespace('expireSingle');
     $result = $this->serialize($s->getIterator());
     $this->assertEquals('p=plum;', $result, 'iteration over named Session namespace failed');
 }
開發者ID:vrana,項目名稱:nette,代碼行數:30,代碼來源:NetteWebSessionTest.php

示例8: resumeOrStartSession

 /**
  *
  * Resumes a previous session, or starts a new one, and loads the segment.
  *
  * @return null
  *
  */
 protected function resumeOrStartSession()
 {
     if (!$this->resumeSession()) {
         $this->session->start();
         $this->load();
     }
 }
開發者ID:andrescefe,項目名稱:SAPP,代碼行數:14,代碼來源:Segment.php

示例9: login

 static function login($data)
 {
     if (!isset($data["username"])) {
         return self::UM_NoUserError;
     } else {
         $u = false;
         $logged = false;
         //check nick and password
         $u = self::loadUserByNickname($data["username"]);
         // assumo che la password mi sia arrivata in chiaro attraverso una connessione sicura
         if ($u !== false && $u->getPassword() == Filter::encodePassword($data["password"])) {
             $logged = true;
         }
         if ($u === false) {
             //check mail and password
             $u = self::loadUserByMail($data["username"]);
             // assumo che la password mi sia arrivata in chiaro attraverso una connessione sicura
             if ($u !== false && $u->getPassword() == Filter::encodePassword($data["password"])) {
                 header("location: " . FileManager::appendToRootPath());
             }
         }
         if ($u !== false) {
             if ($logged) {
                 if (Session::start($u)) {
                     return true;
                 } else {
                     return self::UM_NoSessionError;
                 }
             }
             return self::UM_NoPasswordError;
         }
         return self::UM_NoUserError;
     }
 }
開發者ID:Esisto,項目名稱:IoEsisto,代碼行數:34,代碼來源:UserManager.php

示例10: bootstrap

 public function bootstrap()
 {
     $this->constant();
     //加載服務配置項
     $servers = (require __DIR__ . '/service.php');
     $config = (require ROOT_PATH . '/system/config/service.php');
     $servers['providers'] = array_merge($config['providers'], $servers['providers']);
     $servers['facades'] = array_merge($config['facades'], $servers['facades']);
     $this->servers = $servers;
     //自動加載係統服務
     Loader::register([$this, 'autoload']);
     //綁定核心服務提供者
     $this->bindServiceProvider();
     //添加初始實例
     $this->instance('App', $this);
     //設置外觀類APP屬性
     ServiceFacade::setFacadeApplication($this);
     //啟動服務
     $this->boot();
     //定義錯誤/異常處理
     Error::bootstrap();
     //命令行模式
     IS_CLI and die(Cli::bootstrap());
     //導入類庫別名
     Loader::addMap(c('app.alias'));
     //自動加載文件
     Loader::autoloadFile();
     //開啟會話
     Session::start();
     //執行全局中間件
     Middleware::globals();
     //解析路由
     Route::dispatch();
 }
開發者ID:houdunwang,項目名稱:hdphp,代碼行數:34,代碼來源:App.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     Artisan::call('migrate');
     Artisan::call('db:seed');
     Session::start();
 }
開發者ID:BaobabHealthTrust,項目名稱:iBLIS,代碼行數:7,代碼來源:TestControllerTest.php

示例12: setUp

 /**
  * set up start
  */
 public function setUp()
 {
     parent::setUp();
     Session::start();
     // $this->mock = Mockery::mock('\App\Group');
     $this->id_test = Module::all()->first()->id;
 }
開發者ID:phanngoc,項目名稱:internal-tool,代碼行數:10,代碼來源:ModuleControllerTest.php

示例13: __construct

 function __construct()
 {
     global $_G;
     parent::__construct();
     loadLib('Session');
     Session::start(db(), "{$_G['db_prefix']}session");
 }
開發者ID:frycnx,項目名稱:jxc,代碼行數:7,代碼來源:Login.php

示例14: testMinification

 public function testMinification()
 {
     Session::start();
     $response = $this->post('process', ['html' => '<p><!--This is a comment--></p>', '_token' => csrf_token()])->withoutMiddleware();
     $this->assertResponseOk();
     $this->assertJson('{"html": "<p></p>"}');
 }
開發者ID:ArjanSchouten,項目名稱:HtmlMinifierApplication,代碼行數:7,代碼來源:MinificationTest.php

示例15: run

 public static function run()
 {
     Connection::connect();
     Session::start();
     Router::run();
     Connection::disconnect();
 }
開發者ID:albertomoreno,項目名稱:web-newspaper,代碼行數:7,代碼來源:App.php


注:本文中的Session::start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。