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


PHP Storage::read方法代码示例

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


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

示例1: validate

 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     // compare protection code
     if (property_exists($this->_data, 'protection_code')) {
         $protectionCode = \Storage::read('protection-code-register');
         \Storage::remove('protection-code-register');
         if ($this->_data->protection_code !== $protectionCode) {
             $this->addMessage('protection_code', \View::$language->register_form_protection_code_invalid);
         }
     }
     // compare password confirmation
     if (property_exists($this->_data, 'password') && property_exists($this->_data, 'confirm_password') && $this->_data->password !== $this->_data->confirm_password) {
         $this->addMessage('confirm_password', \View::$language->register_form_password_confirm_mismatch);
     }
     // check for existence
     if ($this->isValid()) {
         $checkedFields = array('email', 'login');
         $UserModel = \App::getInstance('common\\UserModel');
         foreach ($checkedFields as $fName) {
             if ($UserModel->isExists($fName, $this->_data->{$fName})) {
                 $mKey = 'register_form_' . $fName . '_is_exists';
                 $this->addMessage($fName, \View::$language->{$mKey});
             }
         }
     }
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:34,代码来源:RegisterForm.php

示例2: testWhatYouWriteIsReadBack

 public function testWhatYouWriteIsReadBack()
 {
     $data = array('this' => 'is', 'a' => 'sample');
     Storage::write($data);
     $read = Storage::read();
     $this->assertEquals($read, $data);
     // Actual, Expected <-- alphabetic order
 }
开发者ID:aercolino,项目名称:tech-test,代码行数:8,代码来源:storageTest.php

示例3: loadGitLabUser

 /**
  * load gitlab user data from file.
  *
  * @return type user list(json encoding)
  */
 public function loadGitLabUser()
 {
     if (\Storage::has($this->userList)) {
         $users = \Storage::read($this->userList);
         return json_decode($users, true);
     }
     // if file not exist, create empty list.
     return [];
 }
开发者ID:dw250100785,项目名称:gitlab-jira-integration,代码行数:14,代码来源:UserController.php

示例4: html_before

 /**
  *html静态文件缓存
  * @access protected
  * @param string $filename 生成的静态文件名称
  * @param string $filepath 生成的静态文件路径
  * @param string $expire 静态文件缓存时间
  * @return void
 */
 protected function html_before($filename = '',$filepath = '',$expire = 15){
     $suffix = C('HTML_FILE_SUFFIX')?C('HTML_FILE_SUFFIX'):'shtml';
     if($filename === '' && $filepath === ''){
         $filename = APP_PATH.'/static/'.__ACTION__.'.'.$suffix;
     }else{
         $filename = $filename?$filename.'.'.$suffix:md5(__ACTION__).'.'.$suffix;
         $filepath = $filepath?APP_PATH.'/'.$filepath:APP_PATH.'/static';
         $filename = $filepath.'/'.$filename;
     }
     if(Storage::has($filename)){
         if(time() - Storage::get($filename,'mtime') < $expire){
             exit(Storage::read($filename));
         }
     }
     $this->filename = $filename;
 }
开发者ID:king192,项目名称:mycollects,代码行数:24,代码来源:Controller.class.php

示例5: validate

 /**
  * validate
  *
  * Run validation process
  *
  * @return null
  */
 public function validate()
 {
     parent::validate();
     // compare protection code
     if (property_exists($this->_data, 'protection_code')) {
         $protectionCode = \Storage::read('protection-code-sign-in');
         \Storage::remove('protection-code-sign-in');
         if ($this->_data->protection_code !== $protectionCode) {
             $this->addMessage('protection_code', \View::$language->sign_in_form_protection_code_invalid);
         }
     }
     // remove sign in counter data
     if ($this->isValid()) {
         \Storage::remove('sign-in-tries');
     }
 }
开发者ID:nsedenkov,项目名称:phpsu,代码行数:23,代码来源:SignInForm.php

示例6: read

 public function read()
 {
     //cached file exists?
     $cache = $this->options['cacheDir'] . md5($this->options['cacheId']);
     if (!file_exists($cache)) {
         return null;
     }
     $now = time();
     $timeout = $this->options['timeout'];
     //read timestamp
     $data = json_decode(Storage::read($cache), true);
     $timestamp = $data['timestamp'];
     if ($now - $timestamp <= $timeout) {
         return $data['data'];
     } else {
         //cache expired
         Storage::delete($cache);
         return null;
     }
 }
开发者ID:MusicalAPP,项目名称:php-lastfm,代码行数:20,代码来源:Flatcache.php

示例7: list

<?php

require_once CONFIG::get('ABSPATH') . '/src/models/person.php';
require_once CONFIG::get('ABSPATH') . '/src/models/storage.php';
$display['page_title'] = 'People';
list($display['page_error'], $errors) = post_errors();
if ($display['page_error']) {
    d_($display['page_error']);
}
if ($errors) {
    d_($errors);
}
$stored_people = Storage::read() ?? [];
if (count($stored_people)) {
    $display['stored_people'] = array_map(function ($item) {
        return htmlspecialchars("{$item}");
    }, $stored_people);
    $display['people'] = array_map(function ($item) {
        return $item->toHash();
    }, $stored_people);
} else {
    $display['stored_people'] = [];
    $display['people'][] = array('firstname' => 'Jeff', 'surname' => 'Stelling');
    $display['people'][] = array('firstname' => 'Chris', 'surname' => 'Kamara');
    $display['people'][] = array('firstname' => 'Alex', 'surname' => 'Hammond');
    $display['people'][] = array('firstname' => 'Jim', 'surname' => 'White');
    $display['people'][] = array('firstname' => 'Natalie', 'surname' => 'Sawyer');
}
$display['button_OK'] = merge_params($url_string, array('action' => 'save'));
render(CONFIG::get('ABSPATH') . '/src/views/templates/people/list.php', CONFIG::get('ABSPATH') . '/src/views/layouts/flat.php');
开发者ID:aercolino,项目名称:tech-test,代码行数:30,代码来源:a_list.php


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