当前位置: 首页>>代码示例>>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;未经允许,请勿转载。