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


PHP CASHSystem::startSession方法代码示例

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


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

示例1: embedElement

 /**
  * The main public method to embed elements. Notice that it echoes rather
  * than returns, because it's meant to be used simply by calling and spitting
  * out the needed code...
  *
  * @return none
  */
 public static function embedElement($element_id, $access_method = 'direct', $location = false, $geo = false)
 {
     // fire up the platform sans-direct-request to catch any GET/POST info sent
     // in to the page
     CASHSystem::startSession();
     $cash_page_request = new CASHRequest(null);
     $initial_page_request = $cash_page_request->sessionGet('initial_page_request', 'script');
     if ($initial_page_request && isset($initial_page_request['request']['element_id'])) {
         // now test that the initial POST/GET was targeted for this element:
         if ($initial_page_request['request']['element_id'] == $element_id) {
             $status_uid = $initial_page_request['response']['status_uid'];
             $original_request = $initial_page_request['request'];
             $original_response = $initial_page_request['response'];
         } else {
             $status_uid = false;
             $original_request = false;
             $original_response = false;
         }
     } else {
         $status_uid = false;
         $original_request = false;
         $original_response = false;
     }
     $cash_body_request = new CASHRequest(array('cash_request_type' => 'element', 'cash_action' => 'getmarkup', 'id' => $element_id, 'status_uid' => $status_uid, 'original_request' => $original_request, 'original_response' => $original_response, 'access_method' => $access_method, 'location' => $location, 'geo' => $geo));
     if ($cash_body_request->response['status_uid'] == 'element_getmarkup_400') {
         // there was no element found. so you know...punt
         echo '<div class="cashmusic error">Element #' . $element_id . ' could not be found.</div>';
     }
     if (is_string($cash_body_request->response['payload'])) {
         // element found and happy. spit it out.
         echo $cash_body_request->response['payload'];
     }
     if ($cash_body_request->sessionGet('initialized_element_' . $element_id, 'script')) {
         // second half of a wrapper element — fringe case
         if (ob_get_level()) {
             ob_flush();
         }
     }
     unset($cash_page_request);
     unset($cash_body_request);
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:48,代码来源:CASHSystem.php

示例2: testWhatever

 function testWhatever()
 {
     $request = new CASHRequest();
     // test script-scope sesstion values:
     $value = $request->sessionGet('foobar', 'script');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz', 'script');
     $value = $request->sessionGet('foobar', 'script');
     $this->assertEqual($value, 'baz');
     $request->sessionClear('foobar', 'script');
     $value = $request->sessionGet('foobar', 'script');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz', 'script');
     $request->sessionClearAll();
     $value = $request->sessionGet('foobar', 'script');
     $this->assertFalse($value);
     // test persistent-scope sesstion values:
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz');
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
     // fail without startSession()
     $session = CASHSystem::startSession();
     $this->assertTrue($session);
     echo 'Session started: ' . json_encode($session) . "\n";
     $request->sessionSet('foobar', 'baz');
     $value = $request->sessionGet('foobar');
     $this->assertEqual($value, 'baz');
     $request->sessionClear('foobar');
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
     $request->sessionSet('foobar', 'baz');
     $request->sessionClearAll();
     $value = $request->sessionGet('foobar');
     $this->assertFalse($value);
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:37,代码来源:006_CASHData.php


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