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


PHP fSession::add方法代码示例

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


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

示例1: testAddToNonArray

 public function testAddToNonArray()
 {
     $this->setExpectedException('fProgrammerException');
     fSession::open();
     fSession::set('non_array', 'value');
     fSession::add('non_array', 'value2');
 }
开发者ID:philip,项目名称:flourish,代码行数:7,代码来源:fSessionTest.php

示例2: generateCSRFToken

 /**
  * Returns a request token that should be placed in each HTML form to prevent [http://en.wikipedia.org/wiki/Cross-site_request_forgery cross-site request forgery]
  * 
  * This method will return a random 15 character string that should be
  * placed in a hidden `input` element on every HTML form. When the form
  * contents are being processed, the token should be retrieved and passed
  * into ::validateCSRFToken().
  * 
  * The value returned by this method is stored in the session and then
  * checked by the validate method, which helps prevent cross site request
  * forgeries and (naive) automated form submissions.
  * 
  * Tokens generated by this method are single use, so a user must request
  * the page that generates the token at least once per submission.
  * 
  * @param  string $url  The URL to generate a token for, default to the current page
  * @return string  The token to be submitted with the form
  */
 public static function generateCSRFToken($url = NULL)
 {
     if ($url === NULL) {
         $url = fURL::get();
     }
     $token = fCryptography::randomString(16);
     fSession::add(__CLASS__ . '::' . $url . '::csrf_tokens', $token);
     return $token;
 }
开发者ID:hibble,项目名称:printmaster,代码行数:27,代码来源:fRequest.php


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