當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WindFile::read方法代碼示例

本文整理匯總了PHP中WindFile::read方法的典型用法代碼示例。如果您正苦於以下問題:PHP WindFile::read方法的具體用法?PHP WindFile::read怎麽用?PHP WindFile::read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WindFile的用法示例。


在下文中一共展示了WindFile::read方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postUpload

 protected function postUpload($tmp_name, $filename)
 {
     if (strpos($filename, '..') !== false || strpos($filename, '.php.') !== false || preg_match('/\\.php$/', $filename)) {
         exit('illegal file type!');
     }
     WindFolder::mkRecur(dirname($filename));
     if (function_exists("move_uploaded_file") && @move_uploaded_file($tmp_name, $filename)) {
         @unlink($tmp_name);
         @chmod($filename, 0777);
         return filesize($filename);
     } elseif (@copy($tmp_name, $filename)) {
         @unlink($tmp_name);
         @chmod($filename, 0777);
         return filesize($filename);
     } elseif (is_readable($tmp_name)) {
         Wind::import('WIND:utility.WindFile');
         WindFile::write($filename, WindFile::read($tmp_name));
         @unlink($tmp_name);
         if (file_exists($filename)) {
             @chmod($filename, 0777);
             return filesize($filename);
         }
     }
     return false;
 }
開發者ID:ccq18,項目名稱:EduSoho,代碼行數:25,代碼來源:WindFormUpload.php

示例2: parse_properties_file

 /**
  * 解析properties文件並返回一個多維數組
  * 
  * 載入一個由 filename 指定的 properties 文件,
  * 並將其中的設置作為一個聯合數組返回。
  * 
  * @param string $filename 文件名
  * @return array
  */
 private function parse_properties_file($filename)
 {
     if (!is_file($filename) || !in_array(substr($filename, strrpos($filename, '.') + 1), array('properties'))) {
         return array();
     }
     $content = explode("\n", WindFile::read($filename));
     $data = array();
     $last_process = $current_process = '';
     foreach ($content as $key => $value) {
         $value = str_replace(array("\n", "\r"), '', trim($value));
         if (0 === strpos(trim($value), self::COMMENT) || in_array(trim($value), array('', "\t", "\n"))) {
             continue;
         }
         $tmp = explode('=', $value, 2);
         if (0 === strpos(trim($value), self::LPROCESS) && strlen($value) - 1 === strrpos($value, self::RPROCESS)) {
             $current_process = $this->trimChar(trim($value), array(self::LPROCESS, self::RPROCESS));
             $data[$current_process] = array();
             $last_process = $current_process;
             continue;
         }
         $tmp[0] = trim($tmp[0]);
         if (count($tmp) == 1) {
             $last_process ? $data[$last_process][$tmp[0]] = '' : ($data[$tmp[0]] = '');
             continue;
         }
         $tmp[1] = trim($tmp[1], '\'"');
         $__tmpValue = strtolower($tmp[1]);
         $tmp[1] = 'false' === $__tmpValue ? false : ('true' === $__tmpValue ? true : $tmp[1]);
         $last_process ? $data[$last_process][$tmp[0]] = $tmp[1] : ($data[$tmp[0]] = $tmp[1]);
     }
     return $data;
 }
開發者ID:latticet,項目名稱:EduSoho_jb51,代碼行數:41,代碼來源:WindPropertiesParser.php

示例3: getTemplateFileContent

 /**
  * 獲得模板文件內容,目前隻支持本地文件獲取
  * 
  * @param string $templateFile
  * @return string
  */
 private function getTemplateFileContent($templateFile)
 {
     if (false === ($content = WindFile::read($templateFile))) {
         throw new WindViewException('[viewer.AbstractWindViewTemplate.getTemplateFileContent] Unable to open the template file \'' . $templateFile . '\'.');
     }
     return $content;
 }
開發者ID:ccq18,項目名稱:EduSoho,代碼行數:13,代碼來源:AbstractWindViewTemplate.php

示例4: _getMP3Audio

 private static function _getMP3Audio()
 {
     self::$_audioVerify = '';
     $_len = Pw::strlen(self::$verifyCode);
     for ($i = 0; $i < $_len; $i++) {
         $_code = strtoupper(self::$verifyCode[$i]);
         self::$_audioVerify .= WindFile::read(self::$_audioPath . '/' . $_code . '.mp3', WindFile::READ);
     }
 }
開發者ID:ccq18,項目名稱:EduSoho,代碼行數:9,代碼來源:PwAudioCode.php

示例5: editxmlAction

 /**
  * 編輯xml
  *
  */
 public function editxmlAction()
 {
     $alias = $this->getInput('alias', 'get');
     /* @var $app PwApplication */
     $app = Wekit::load('APPCENTER:service.PwApplication');
     $app = $app->findByAlias($alias);
     $this->setOutput($app, 'app');
     $manifest = WindFile::read(Wind::getRealPath('EXT:' . $alias . '.Manifest.xml', true));
     $this->setOutput($manifest, 'manifest');
 }
開發者ID:chendong0444,項目名稱:phpwind,代碼行數:14,代碼來源:DevelopController.php

示例6: uploadRequest

 public static function uploadRequest($url, $file, $timeout = 30)
 {
     if (!function_exists('fsockopen')) {
         $urlArr = parse_url($url);
         $port = isset($urlArr['port']) ? $urlArr['port'] : 80;
         $boundary = "---------------------" . substr(md5(rand(0, 32000)), 0, 10);
         $header = "POST " . $urlArr['path'] . '?' . $urlArr['query'] . " HTTP/1.0\r\n";
         $header .= "Host: " . $urlArr['host'] . "\r\n";
         $header .= "Content-type: multipart/form-data, boundary=" . $boundary . "\r\n";
         if (!file_exists($file)) {
             return false;
         }
         $imageInfo = @getimagesize($file);
         $exts = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
         if (!isset($exts[$imageInfo[2]])) {
             continue;
         }
         $ext = $exts[$imageInfo[2]];
         $filename = rand(1000, 9999) . '.' . $ext;
         $data = '';
         $data .= "--{$boundary}\r\n";
         $data .= "Content-Disposition: form-data; name=\"FileData\"; filename=\"" . $filename . "\"\r\n";
         $data .= "Content-Type: " . $imageInfo['mime'] . "\r\n\r\n";
         $data .= WindFile::read($file) . "\r\n";
         $data .= "--{$boundary}--\r\n";
         $header .= "Content-length: " . strlen($data) . "\r\n\r\n";
         $fp = fsockopen($urlArr['host'], $port);
         fputs($fp, $header . $data);
         $response = '';
         while (!feof($fp)) {
             $response .= fgets($fp, 128);
         }
         fclose($fp);
         preg_match("/Content-Length:.?(\\d+)/", $response, $matches);
         if (isset($matches[1])) {
             $response = substr($response, strlen($response) - intval($matches[1]));
         }
         return $response;
     } elseif (function_exists('curl_init')) {
         $curl = curl_init($url);
         curl_setopt($curl, CURLOPT_POST, true);
         curl_setopt($curl, CURLOPT_POSTFIELDS, $file);
         curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
         $response = curl_exec($curl);
         curl_close($curl);
         return $response;
     } else {
         return false;
     }
 }
開發者ID:YoursBoss,項目名稱:nextwind,代碼行數:52,代碼來源:WindidUtility.php

示例7: save

 /**
  * 存儲附件,如果是遠程存儲,記得刪除本地文件
  *
  * @param string $source 本地源文件地址
  * @param string $filePath 存儲相對位置
  * @return bool
  */
 public function save($source, &$filePath)
 {
     $data = WindFile::read($source);
     $stuff = WindFile::getSuffix($source);
     $result = $this->_getCdn()->write($data, $stuff);
     if ($result) {
         Pw::deleteFile($source);
         $filePath = $result;
         return true;
     } else {
         return false;
     }
 }
開發者ID:latticet,項目名稱:EduSoho_jb51,代碼行數:20,代碼來源:PwStorageCdn.php

示例8: compile

 /**
  * 編譯模板並返回編譯後模板地址及內容
  * 
  * <pre>
  * <i>$output==true</i>返回編譯文件絕對路徑地址和內容,不生成編譯文件;
  * <i>$output==false</i>返回編譯文件絕對路徑地址和內容,生成編譯文件
  * </pre>
  * 
  * @param string $template 模板名稱 必填
  * @param string $suffix 模板後綴 默認為空 
  * @param boolean $readOnly 是否直接輸出模板內容,接受兩個值true,false 默認值為false
  * @param boolean $forceOutput 是否強製返回模板內容,默認為不強製
  * @return array(compileFile,content) <pre>
  * <i>compileFile</i>模板編譯文件絕對地址,
  * <i>content</i>編譯後模板輸出內容,當<i>$output</i>
  * 為false時將content寫入compileFile</pre>
  */
 public function compile($template, $suffix = '', $readOnly = false, $forceOutput = false)
 {
     $templateFile = $this->windView->getViewTemplate($template, $suffix);
     if (!is_file($templateFile)) {
         throw new WindViewException('[component.viewer.WindViewerResolver.compile] ' . $templateFile, WindViewException::VIEW_NOT_EXIST);
     }
     $compileFile = $this->windView->getCompileFile($template);
     if (!$this->checkReCompile($templateFile, $compileFile)) {
         return array($compileFile, $forceOutput ? WindFile::read($compileFile) : '');
     }
     /* @var $_windTemplate WindViewTemplate */
     $_windTemplate = Wind::getApp()->getComponent('template');
     $_output = $_windTemplate->compile($templateFile, $this);
     $readOnly === false && WindFile::write($compileFile, $_output);
     return array($compileFile, $_output);
 }
開發者ID:jellycheng,項目名稱:windframework,代碼行數:33,代碼來源:WindViewerResolver.php

示例9: compile

 /**
  * 編譯模板並返回編譯後模板地址及內容
  * <pre>
  * <i>$output==true</i>返回編譯文件絕對路徑地址和內容,不生成編譯文件;
  * <i>$output==false</i>返回編譯文件絕對路徑地址和內容,生成編譯文件
  * </pre>
  * 
  * @param string $template 模板名稱 必填
  * @param string $suffix 模板後綴 默認為空
  * @param boolean $readOnly 是否直接輸出模板內容,接受兩個值true,false 默認值為false
  * @param boolean $forceOutput 是否強製返回模板內容,默認為不強製
  * @return array(compileFile,content) <pre>
  *         <i>compileFile</i>模板編譯文件絕對地址,
  *         <i>content</i>編譯後模板輸出內容,當<i>$output</i>
  *         為false時將content寫入compileFile</pre>
  */
 public function compile($template, $suffix = '', $readOnly = false, $forceOutput = false)
 {
     list($templateFile, $compileFile, $this->currentThemeKey) = $this->windView->getViewTemplate($template, $suffix);
     if (!is_file($templateFile)) {
         throw new WindViewException('[viewer.resolver.WindViewerResolver.compile] ' . $templateFile, WindViewException::VIEW_NOT_EXIST);
     }
     if (!$this->checkReCompile($templateFile, $compileFile)) {
         return array($compileFile, $forceOutput || $readOnly ? WindFile::read($compileFile) : '');
     }
     /* @var $_windTemplate WindViewTemplate */
     $_windTemplate = Wind::getComponent('template');
     $_output = $_windTemplate->compile($templateFile, $this);
     if (false === $readOnly) {
         WindFolder::mkRecur(dirname($compileFile));
         WindFile::write($compileFile, $_output);
     }
     return array($compileFile, $_output);
 }
開發者ID:fanqimeng,項目名稱:4tweb,代碼行數:34,代碼來源:WindViewerResolver.php

示例10: doCompile

 public function doCompile()
 {
     $JS_DEV_PATH = Wind::getRealDir('PUBLIC:res.js.dev');
     $JS_BUILD_PATH = Wind::getRealDir('PUBLIC:res.js.build');
     Wind::import('Wind:utility.WindFolder');
     $files = $this->_getFiles($JS_DEV_PATH);
     foreach ($files as $file) {
         $newfile = $JS_BUILD_PATH . substr($file, strlen($JS_DEV_PATH));
         WindFolder::mkRecur(dirname($newfile));
         if (substr($file, -3) != '.js') {
             if (!copy($file, $newfile)) {
                 return new PwError('copy failed');
             }
             continue;
         }
         $content = WindFile::read($file);
         $compress = jscompress::pack($content);
         if (!WindFile::write($newfile, $compress)) {
             return new PwError('write failed');
         }
     }
 }
開發者ID:ccq18,項目名稱:EduSoho,代碼行數:22,代碼來源:PwJsCompress.php

示例11: _doCss

 /**
  * @param string $stylePackage
  * @param booelan $isManifestChanged
  * @return boolean
  */
 private function _doCss($stylePackage)
 {
     $file = $stylePackage . '/' . $this->manifest;
     $dir = $stylePackage . '/' . $this->cssDevDir;
     $_dir = $stylePackage . '/' . $this->cssDir;
     WindFolder::mkRecur($_dir);
     $files = WindFolder::read($dir, WindFolder::READ_FILE);
     foreach ($files as $v) {
         if (WindFile::getSuffix($v) === 'css') {
             $dev_css = $dir . '/' . $v;
             //待編譯文件
             $css = $_dir . '/' . $v;
             //編譯後文件
             $data = WindFile::read($dir . '/' . $v);
             $_data = $this->_compress($data);
             if (WindFile::write($css, $_data) === false) {
                 return new PwError('STYLE:style.css.write.fail');
             }
         }
     }
     return true;
 }
開發者ID:latticet,項目名稱:EduSoho_jb51,代碼行數:27,代碼來源:PwCssCompress.php

示例12: checkTxt

 public function checkTxt($filename = '', $content = '')
 {
     if (!$filename && !$content) {
         return new PwError("DESIGN:upload.file.error");
     }
     if ($filename) {
         if (!($content = WindFile::read($filename))) {
             return new PwError("DESIGN:upload.file.error");
         }
     }
     $content = preg_replace("/\\/\\*(.+)\\*\\//", '', $content);
     $content = unserialize(base64_decode($content));
     $_array = array('page', 'segment', 'structure', 'module');
     foreach ($_array as $v) {
         if (!isset($content[$v])) {
             return new PwError("DESIGN:file.check.fail");
         }
     }
     $this->_content = $content;
     if ($filename) {
         WindFile::del($filename);
     }
     return true;
 }
開發者ID:chendong0444,項目名稱:phpwind,代碼行數:24,代碼來源:PwDesignImportTxt.php

示例13: doimportAction

 public function doimportAction()
 {
     Wind::import('SRV:upload.action.PwWordUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwWordUpload();
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $error = $result->getError();
         if (is_array($error)) {
             list($error, ) = $error;
             if ($error == 'upload.ext.error') {
                 $this->showError('WORD:ext.error');
             }
         }
         $this->showError($result->getError());
     }
     $source = $bhv->getAbsoluteFile();
     if (!WindFile::isFile($source)) {
         $this->showError('operate.fail');
     }
     $content = WindFile::read($source);
     pw::deleteAttach($bhv->dir . $bhv->filename, 0, $bhv->isLocal);
     $content = explode("\n", $content);
     if (!$content) {
         $this->showError('WORD:import.data.empty');
     }
     $wordService = $this->_getWordService();
     $typeMap = $this->_getWordDS()->getTypeMap();
     Wind::import('SRV:word.dm.PwWordDm');
     foreach ($content as $value) {
         list($word, $type, $replace) = $this->_parseTextUseInImport($value, $typeMap);
         if (!$word || !$type || $wordService->isExistWord($word)) {
             continue;
         }
         $dm = new PwWordDm();
         /* @var $dm PwWordDm */
         $dm->setWord($word)->setWordType($type);
         $replace = $this->_getWordDS()->isReplaceWord($type) ? $replace ? $replace : '****' : '';
         $dm->setWordReplace($replace);
         $this->_getWordDS()->add($dm);
     }
     $this->_getWordFilter()->updateCache();
     $this->showMessage('success');
 }
開發者ID:chendong0444,項目名稱:phpwind,代碼行數:47,代碼來源:ManageController.php

示例14: _generateService

 protected function _generateService()
 {
     if (!$this->need_service) {
         return true;
     }
     $prefix = 'app_' . $this->alias . '_table';
     $classFrefix = str_replace(' ', '', ucwords('app_ ' . $this->alias . '_ ' . $this->alias));
     WindFolder::mkRecur($this->baseDir . '/service/dao/');
     WindFolder::mkRecur($this->baseDir . '/service/dm/');
     $dao_file = $this->defaultDir . '/service/dao/defaultdao';
     $class_dao = $classFrefix . 'Dao';
     $dao = strtr(WindFile::read($dao_file), array('{{classname}}' => $class_dao, '{{prefix}}' => $prefix, '{{author}}' => $this->author, '{{email}}' => $this->email, '{{website}}' => $this->website));
     WindFile::write($this->baseDir . '/service/dao/' . $class_dao . '.php', $dao);
     $dm_file = $this->defaultDir . '/service/dm/defaultdm';
     $class_dm = $classFrefix . 'Dm';
     $dm = strtr(WindFile::read($dm_file), array('{{classname}}' => $class_dm, '{{author}}' => $this->author, '{{email}}' => $this->email, '{{website}}' => $this->website));
     WindFile::write($this->baseDir . '/service/dm/' . $class_dm . '.php', $dm);
     $ds_file = $this->defaultDir . '/service/defaultds';
     $class_ds = $classFrefix;
     $ds = strtr(WindFile::read($ds_file), array('{{classname}}' => $class_ds, '{{alias}}' => $this->alias, '{{class_dm}}' => $class_dm, '{{class_dao}}' => $class_dao, '{{author}}' => $this->author, '{{email}}' => $this->email, '{{website}}' => $this->website));
     WindFile::write($this->baseDir . '/service/' . $class_ds . '.php', $ds);
 }
開發者ID:chendong0444,項目名稱:phpwind,代碼行數:22,代碼來源:PwGenerateApplication.php

示例15: getValue

 protected function getValue($key)
 {
     if (!is_file($key)) {
         return null;
     }
     return WindFile::read($key);
 }
開發者ID:jellycheng,項目名稱:windframework,代碼行數:7,代碼來源:WindFileCache.php


注:本文中的WindFile::read方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。