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


PHP File::delete方法代码示例

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


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

示例1: __destruct

 public function __destruct()
 {
     /* On efface le model de la base tampon et on vide la base */
     $modelFile = APPLICATION_PATH . DS . 'models' . DS . 'Bigdata' . DS . 'models' . DS . Inflector::lower($this->to->db) . DS . ucfirst(Inflector::lower($this->to->table)) . '.php';
     File::delete($modelFile);
     $this->to->drop();
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:Transaction.php

示例2: bag

 public function bag($k, $data = [])
 {
     $key = sha1($this->getIdentifier() . $k);
     $file = '/home/php/storage/bag/' . $key;
     $data = array_merge($data, ['id' => $key]);
     if (file_exists($file)) {
         $data = array_merge($data, unserialize(File::read($file)));
     }
     return dyn(lib('model', [$data]))->extend('save', function ($app) use($file, $k) {
         $row = $app->getNative()->toArray();
         File::delete($file);
         File::put($file, serialize($row));
         return bag($k);
     })->extend('delete', function ($app) use($file) {
         return File::delete($file);
     });
 }
开发者ID:schpill,项目名称:standalone,代码行数:17,代码来源:clipp.php

示例3: editpageAction

 public function editpageAction()
 {
     $id = request()->getId();
     if (!is_null($id)) {
         $permission = 'cms';
         $auth = auth()->can($permission);
         if (true === $auth || true === $this->isAdmin) {
             $dirPages = realpath(APPLICATION_PATH . DS . '..' . DS . 'public' . DS . 'content' . DS . SITE_NAME . DS . 'pages');
             $dirPartials = realpath(APPLICATION_PATH . DS . '..' . DS . 'public' . DS . 'content' . DS . SITE_NAME . DS . 'partials');
             if (!strlen($dirPages) || !strlen($dirPartials)) {
                 $this->forward('home');
             }
             $pages = File::readdir($dirPages);
             $partials = File::readdir($dirPartials);
             $pages = array_merge($pages, $partials);
             $key = $id - 1;
             $file = isset($pages[$key]) ? $pages[$key] : false;
             if (false !== $file) {
                 if ($this->isPost()) {
                     $html = request()->getHtml();
                     $config = request()->getConfig();
                     $content = "/*\n    {$config}\n*/\n{$html}";
                     File::delete($file);
                     File::put($file, $content);
                     $this->forward('pagelist');
                 } else {
                     $content = fgc($file);
                     $this->view->configPage = repl(array('/*', '*/'), '', $this->getConfigPage($content));
                     $this->view->htmlPage = $this->getHtml($content);
                     $this->view->title = 'Mettre à jour une page';
                 }
             } else {
                 $this->forward('pagelist');
             }
         } else {
             $this->forward('pagelist');
         }
     } else {
         $this->forward('pagelist');
     }
 }
开发者ID:noikiy,项目名称:inovi,代码行数:41,代码来源:staticController.php

示例4: generate

 public static function generate($database, $model, $fields = [], $overwrite = false)
 {
     if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'CrudRaw')) {
         File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'CrudRaw');
     }
     $file = APPLICATION_PATH . DS . 'models' . DS . 'CrudRaw' . DS . ucfirst(Inflector::camelize($database)) . DS . ucfirst(Inflector::camelize($model)) . '.php';
     if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'CrudRaw' . DS . ucfirst(Inflector::camelize($database)))) {
         File::mkdir(APPLICATION_PATH . DS . 'models' . DS . 'CrudRaw' . DS . ucfirst(Inflector::camelize($database)));
     }
     if (!File::exists($file) || $overwrite) {
         $db = Db::instance($database, $model);
         $crud = Crud::instance($db);
         File::delete($file);
         $tplModel = File::read(__DIR__ . DS . 'Model.tpl');
         $tplField = File::read(__DIR__ . DS . 'Field.tpl');
         $fields = empty($fields) ? $crud->fields() : $fields;
         $singular = ucfirst($model);
         $plural = $singular . 's';
         $default_order = $crud->pk();
         $tplModel = str_replace(['##singular##', '##plural##', '##default_order##', '##foreigns##', '##uniques##', '##soft_delete##', '##before_create##', '##after_create##', '##before_update##', '##after_update##', '##before_read##', '##after_read##', '##before_delete##', '##after_delete##', '##before_list##', '##after_list##'], [$singular, $plural, $default_order, '[]', '[]', 'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false', 'false'], $tplModel);
         $fieldsSection = '';
         foreach ($fields as $field) {
             if ($field != $crud->pk()) {
                 $label = substr($field, -3) == '_id' ? ucfirst(str_replace('_id', '', $field)) : ucfirst(Inflector::camelize($field));
                 $fieldsSection .= str_replace(['##field##', '##form_type##', '##helper##', '##required##', '##form_plus##', '##length##', '##is_listable##', '##is_exportable##', '##is_searchable##', '##is_sortable##', '##is_readable##', '##is_creatable##', '##is_updatable##', '##is_deletable##', '##content_view##', '##content_list##', '##content_search##', '##content_create##', '##label##'], [$field, 'text', 'false', 'true', 'false', 'false', 'true', 'true', 'true', 'true', 'true', 'true', 'true', 'true', 'false', 'false', 'false', 'false', $label], $tplField);
             }
         }
         $tplModel = str_replace('##fields##', $fieldsSection, $tplModel);
         File::put($file, $tplModel);
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:31,代码来源:Tools.php

示例5: putInCache

 public function putInCache($key, $data)
 {
     $file = $this->cacheDir . DS . $key;
     File::delete($file);
     File::put($file, serialize($data));
 }
开发者ID:schpill,项目名称:standalone,代码行数:6,代码来源:jdb.php

示例6: clean

 public function clean()
 {
     $glob = glob($this->dir . DS . 'expire.', GLOB_NOSORT);
     foreach ($glob as $row) {
         $row = str_replace([$this->dir . DS, '.raw'], '', $row);
         list($d, $key) = explode('expire.', $row, 2);
         $expire = $this->getFile($row);
         $expiration = (int) unserialize(File::read($expire));
         if (time() > $expiration) {
             $file = $this->getFile($key);
             File::delete($expire);
             File::delete($file);
         }
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:15,代码来源:Store.php

示例7: dispatch

 public static function dispatch()
 {
     header("Access-Control-Allow-Origin: *");
     static::$method = Request::method();
     $uri = substr(str_replace('/mobi/', '/', $_SERVER['REQUEST_URI']), 1);
     $tab = explode('/', $uri);
     if (!strlen($uri) || $uri == '/') {
         $namespace = 'static';
         $controller = 'home';
         $action = 'index';
     } else {
         if (count($tab) < 3) {
             self::isForbidden();
         }
         $namespace = current($tab);
         $controller = $tab[1];
         $action = $tab[2];
         $tab = array_slice($tab, 3);
         $count = count($tab);
         if (0 < $count && $count % 2 == 0) {
             for ($i = 0; $i < $count; $i += 2) {
                 $_REQUEST[$tab[$i]] = $tab[$i + 1];
             }
         }
     }
     $file = APPLICATION_PATH . DS . 'mobi' . DS . $namespace . DS . 'controllers' . DS . $controller . '.php';
     // dd($file);
     if (!File::exists($file)) {
         self::is404();
     }
     require_once $file;
     $class = 'Thin\\' . ucfirst($controller) . 'Mobi';
     $i = new $class();
     $methods = get_class_methods($i);
     $call = strtolower(static::$method) . ucfirst($action);
     if (!Arrays::in($call, $methods)) {
         self::is404();
     }
     if (Arrays::in('init', $methods)) {
         $i->init($call);
     }
     $i->{$call}();
     if ($i->view === true) {
         $tpl = APPLICATION_PATH . DS . 'mobi' . DS . $namespace . DS . 'views' . DS . $controller . DS . $action . '.phtml';
         if (File::exists($tpl)) {
             $content = File::read($tpl);
             $content = str_replace('$this->', '$i->', $content);
             $fileTpl = CACHE_PATH . DS . sha1($content) . '.display';
             File::put($fileTpl, $content);
             ob_start();
             include $fileTpl;
             $html = ob_get_contents();
             ob_end_clean();
             File::delete($fileTpl);
             self::render($html);
         } else {
             self::render('OK');
         }
     }
     if (Arrays::in('after', $methods)) {
         $i->after();
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:63,代码来源:Rest.php

示例8: tpl

 function tpl($tpl)
 {
     $view = container()->getView();
     $view = !is_object($view) ? context()->getView() : $view;
     $tab = explode(DS, $view->_viewFile);
     $path = repl(DS . Arrays::last($tab), '', $view->_viewFile);
     $path = repl($tab[count($tab) - 2], 'partials' . DS . $tpl, $path);
     if (File::exists($path)) {
         $content = fgc($path);
         $content = repl('$this->', '$view->', View::cleanCode($content));
         $file = CACHE_PATH . DS . sha1($content) . '.display';
         File::put($file, $content);
         ob_start();
         include $file;
         $html = ob_get_contents();
         ob_end_clean();
         File::delete($file);
         echo $html;
     }
 }
开发者ID:noikiy,项目名称:inovi,代码行数:20,代码来源:Helper.php

示例9: nextId

 private function nextId()
 {
     $id = File::read($this->ids);
     File::delete($this->ids);
     File::put($this->ids, $id + 1);
     return (int) $id;
 }
开发者ID:schpill,项目名称:standalone,代码行数:7,代码来源:flight.php

示例10: makeId

 private function makeId()
 {
     $file = $this->getFile('coreids');
     if (File::exists($file)) {
         $last = (int) File::read($file);
         $new = $last + 1;
     } else {
         $new = 1;
     }
     File::delete($file);
     File::put($file, (int) $new);
     return $new;
 }
开发者ID:schpill,项目名称:standalone,代码行数:13,代码来源:Db.php

示例11: globids

 public function globids()
 {
     // $rows = new Arr(Arr::INT_TO_INT);
     $rows = [];
     $i = 0;
     $firstLevels = glob($this->model->dir . DS . '*', GLOB_NOSORT);
     foreach ($firstLevels as $firstLevel) {
         $secondLevels = glob($firstLevel . DS . '*', GLOB_NOSORT);
         foreach ($secondLevels as $secondLevel) {
             $files = glob($secondLevel . DS . '*.row', GLOB_NOSORT);
             foreach ($files as $file) {
                 $id = str_replace('.row', '', Arrays::last(explode(DS, $file)));
                 if (is_numeric($id)) {
                     $rows[$i] = $id;
                     $i++;
                 } else {
                     File::delete($file);
                 }
             }
         }
     }
     return $rows;
 }
开发者ID:schpill,项目名称:standalone,代码行数:23,代码来源:Local.php

示例12: seeds

 public function seeds($database = null)
 {
     set_time_limit(0);
     $database = is_null($database) ? SITE_NAME : $database;
     $path = STORAGE_PATH . DS . 'seeds';
     if (!is_dir($path)) {
         File::mkdir($path);
     }
     $now = time();
     $db = $this->getOdm();
     $backup = self::instance('core', 'backup');
     $collections = $db->getCollectionNames();
     $key = array_search('zelift.ages', $collections);
     if (strlen($key)) {
         unset($collections[$key]);
     }
     $key = array_search('zelift.counters', $collections);
     if (strlen($key)) {
         unset($collections[$key]);
     }
     $key = array_search('zelift.tuples', $collections);
     if (strlen($key)) {
         unset($collections[$key]);
     }
     $key = array_search('zelift.caching', $collections);
     if (strlen($key)) {
         unset($collections[$key]);
     }
     $key = array_search('zelift.ages', $collections);
     if (strlen($key)) {
         unset($collections[$key]);
     }
     foreach ($collections as $coll) {
         list($collDb, $collTable) = explode('.', $coll, 2);
         if ($collDb != $database) {
             continue;
         }
         $row = $backup->where(['collection', '=', $coll])->first(true);
         if (!$row) {
             $row = $backup->firstOrCreate(['collection' => $coll])->setWhen($now)->save();
         }
         $file = STORAGE_PATH . DS . 'seeds' . DS . str_replace('.', '_', $coll) . '.php';
         $model = self::instance($collDb, $collTable);
         $last = $model->where(['id', '>', 0])->select('updated_at')->order('updated_at', 'DESC')->first(true);
         if ($last) {
             if ($last->updated_at > $row->when || !File::exists($file)) {
                 if (!File::exists($file)) {
                     $datas = $model->select('id')->get();
                 } else {
                     $datas = $model->where(['updated_at', '>=', (int) $now])->select('id')->get();
                     File::delete($file);
                 }
                 if (!empty($datas)) {
                     File::put($file, '<?php' . "\nnamespace Thin;\n\n");
                     $code = '';
                     $code .= '$db = rdb("' . $collDb . '", "' . $collTable . '");' . "\n\n\n";
                     File::append($file, $code);
                     foreach ($datas as $rowData) {
                         $data = $model->find((int) $rowData['id'], false);
                         $codeRow = '// *** ligne ' . $data['id'] . ' ***' . "\n";
                         $codeRow .= '$row = $db->find(' . $data['id'] . ');' . "\n\n";
                         $codeRow .= 'if (!$row) {' . "\n";
                         $codeRow .= "\t" . '$row = $db->addWithId(["id" => ' . $data['id'] . ']);' . "\n";
                         $codeRow .= '}' . "\n\n";
                         unset($data['id']);
                         $codeRow .= '$data = ' . var_export($data, 1) . ';' . "\n";
                         $codeRow .= '$row->hydrate($data)->save();' . "\n";
                         $codeRow .= '// *** fin ligne ' . $data['id'] . ' ***' . "\n\n";
                         File::append($file, $codeRow);
                     }
                     $row->setWhen($now)->save();
                 }
             }
         }
     }
     dd(Timer::get());
 }
开发者ID:schpill,项目名称:standalone,代码行数:77,代码来源:Db.php

示例13: hremove

 public function hremove($hash)
 {
     $glob = glob($this->dir . DS . 'hash.' . $hash . DS . '*.store', GLOB_NOSORT);
     foreach ($glob as $row) {
         File::delete($row);
     }
     return true;
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:store.php

示例14: _buffer

 private static function _buffer($key, $data = null)
 {
     if (false === static::$_buffer) {
         return false;
     }
     $timeToBuffer = false !== static::$_cache ? static::$_cache * 60 : 2;
     $ext = false !== static::$_cache ? 'cache' : 'buffer';
     $file = CACHE_PATH . DS . $key . '_nosql.' . $ext;
     if (File::exists($file)) {
         $age = time() - File::modified($file);
         if ($age > $timeToBuffer) {
             File::delete($file);
         } else {
             return static::unserialize(static::load($file));
         }
     }
     if (null === $data) {
         return false;
     }
     File::put($file, static::serialize($data));
 }
开发者ID:schpill,项目名称:thin,代码行数:21,代码来源:Data.php

示例15: makeId

 private function makeId()
 {
     $file = $this->dir . DS . 'lastid.blazz';
     if (is_file($file)) {
         $last = File::read($file);
         $new = $last + 1;
         File::delete($file);
         File::put($file, $new);
         return $new;
     }
     File::put($file, 1);
     return 1;
 }
开发者ID:schpill,项目名称:standalone,代码行数:13,代码来源:blazz.php


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