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


PHP FileSystem::write方法代码示例

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


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

示例1: actionCreate

	public function actionCreate($dir, $fileName)
	{
		if (FileSystem::write('./'.$dir.'/'.$fileName, '', 'x'))
			$msg = 'Файл Создан';
		else
			$msg = 'Файл Не Создан';
			
		echo CJSON::encode(array('msg' => $msg));
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:9,代码来源:FilesController.php

示例2: update

 public function update()
 {
     $dir = 'mainContent.components.widgets.views.MainContent.'.$this->widgetModel->pk.'.';
             
     if (isset($_POST['list-template'])) {
         FileSystem::write(Yii::getPathOfAlias($dir.'listTemplate').'.twig', $_POST['list-template']);
     }
     if (isset($_POST['item'])) {
         FileSystem::write(Yii::getPathOfAlias($dir.'item').'.twig', $_POST['item']);
     }
     if (isset($_POST['full'])) {
         FileSystem::write(Yii::getPathOfAlias($dir.'full').'.twig', $_POST['full']);
     }
 }
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:14,代码来源:MainContentWidget.php

示例3: stream_write

 /**
  * Write to stream
  */
 public function stream_write($data)
 {
     if (!in_array($this->mode, ['w', 'w+', 'a', 'a+', 'x', 'x+', 'c', 'c+'])) {
         return 0;
     }
     //TODO: lock directory to ensure it exists when file is created
     $filename = $this->getFileName();
     $dirname = dirname($filename);
     if (!$this->fileSystem->isDirectory($dirname)) {
         trigger_error("Directory {$dirname} not exists", E_USER_WARNING);
         return 0;
     }
     $fpos = $this->fpos;
     if (in_array($this->mode, ['a', 'a+'])) {
         $fpos = -1;
     }
     $bytesWritten = $this->fileSystem->write($filename, $fpos, $data);
     if (!in_array($this->mode, ['a', 'a+'])) {
         $this->fpos += $bytesWritten;
     }
     return $bytesWritten;
 }
开发者ID:sallyx,项目名称:redis-php-stream-wrapper,代码行数:25,代码来源:Wrapper.php

示例4: catch

// TODO: considerar el language de la app
$ctx = YuppContext::getInstance();
$locale = $ctx->setLocale('en');
// Hace el request y catchea por posibles errores.
try {
    RequestManager::doRequest();
} catch (Exception $e) {
    // FIXME: mostrar la vista de error 500
    // FIXME: en modo PROD NUNCA deberia mostrar paths ni el stacktrace.
    // http://code.google.com/p/yupp/issues/detail?id=147
    if (YuppConfig::getInstance()->getCurrentMode() === YuppConfig::MODE_PROD) {
        echo 'Disculpe las molestias, verificaremos el error en breve.';
        // FIXME: i18n
        // Redirect a pagina de error por defecto?
        if (file_exists('ylogs/500')) {
            FileSystem::write('ylogs/500/err_' . date("Ymd.his") . '.log', print_r($ctx, true));
        }
    } else {
        echo '<html><body>';
        echo '<h1>Ha ocurrido un error!</h1>';
        // TODO: i18n
        echo '<div style="border:1px solid #333; padding:10px; width:800px;">';
        echo '<div style="border:1px solid #333; background-color:#ffffaa; overflow:auto; padding:5px; margin-bottom:2px;">';
        echo 'Mensaje:';
        // TODO: i18n
        echo '</div>';
        echo '<div style="border:1px solid #333; background-color:#ffff80; overflow:auto; padding:10px;">';
        echo $e->getMessage() . " [" . $e->getFile() . " : " . $e->getLine() . "]";
        echo '</div>';
        //print_r( $e->getTrace() );
        echo '<div style="border:1px solid #333; background-color:#ffaaaa; overflow:auto; padding:5px; margin-bottom:2px; margin-top:10px;">';
开发者ID:fkali,项目名称:yupp,代码行数:31,代码来源:index.php

示例5: FileSystem

<?php

// Load in the file system class
include 'filesystem.class2.php';
$file = new FileSystem();
// Write to file (silent)
$filename = "../includes/nyheder/nyhedstitel.html";
$content = $_POST["titelnyhed"];
$file->write($filename, $content);
// Write to file (silent)
$filename = "../includes/nyheder/nyhedstekst.html";
$content = $_POST["tekstnyhed"];
$file->write($filename, $content);
// Redirect to form
header('Location: ../nyheder.php?success');
开发者ID:salvahp,项目名称:2.2,代码行数:15,代码来源:process2.php

示例6: create

 /**
  * Crea una nueva aplicacion con nombre $name.
  * En $params se pasarian parametros extra como clases del
  * modelo y sus campos para crear una estructura mas rica.
  * Este parametro todavia no se usa.
  * Tira una excepcion si no puede crear la estructura de directorios.
  */
 public static function create($name, $params = array())
 {
     $normalizedName = String::toUnderscore(String::filterCharacters($name));
     $appStruct = array('./apps/' . $normalizedName, './apps/' . $normalizedName . '/controllers', './apps/' . $normalizedName . '/model', './apps/' . $normalizedName . '/views', './apps/' . $normalizedName . '/services', './apps/' . $normalizedName . '/i18n', './apps/' . $normalizedName . '/bootstrap', './apps/' . $normalizedName . '/config', './apps/' . $normalizedName . '/utils');
     foreach ($appStruct as $package) {
         //echo "intenta crear $package<br/>";
         if (!file_exists($package) && !mkdir($package)) {
             throw new Exception('No se puede crear el directorio ' . $package . ', verifique que tiene los permisos suficientes');
         }
     }
     // FIXME: pueden venir tildes y cualquier tipo de caracter, deberia filtrar todo lo que venga mal, o pedirle que lo corrija.
     // TODO: crear descriptor con el nombre de la app
     $appDescriptor = FileSystem::read('./core/app/templates/app.xml');
     $appDescriptor = str_replace('{appName}', $name, $appDescriptor);
     if (isset($params['description'])) {
         $appDescriptor = str_replace('{appDescription}', $params['description'], $appDescriptor);
     }
     if (isset($params['langs'])) {
         $appDescriptor = str_replace('{appLangs}', $params['langs'], $appDescriptor);
     }
     if (isset($params['controller'])) {
         $appDescriptor = str_replace('{epController}', $params['controller'], $appDescriptor);
         $appDescriptor = str_replace('{epAction}', 'index', $appDescriptor);
         $templateController = FileSystem::read('./core/app/templates/TemplateController.class.php');
         $templateController = str_replace('Template', String::firstToUpper($params['controller']), $templateController);
         echo './apps/' . $normalizedName . '/controllers/apps.' . $normalizedName . '.controllers.' . String::firstToUpper($params['controller']) . 'Controller.class.php';
         FileSystem::write('./apps/' . $normalizedName . '/controllers/apps.' . $normalizedName . '.controllers.' . String::firstToUpper($params['controller']) . 'Controller.class.php', $templateController);
     }
     FileSystem::write('./apps/' . $normalizedName . '/app.xml', $appDescriptor);
 }
开发者ID:fkali,项目名称:yupp,代码行数:37,代码来源:core.app.App.class.php

示例7: update

	public function update()
	{
		return FileSystem::write($this->filePath.'/'.$this->alias.$this->ext, $this->template, 'w');
	}
开发者ID:nizsheanez,项目名称:PolymorphCMS,代码行数:4,代码来源:Template.php

示例8: mkdir

      <?php 
// http://code.google.com/p/yupp/issues/detail?id=147
if (YuppConfig::getInstance()->getCurrentMode() === YuppConfig::MODE_PROD) {
    ?>
        Disculpe las molestias, verificaremos el error en breve.
        <?php 
    // TODO: esto deberia estar en Logger
    // log a disco
    /*
    if (!file_exists('_manage_errors'))
    {
       mkdir('_manage_errors', 755);
    }
    */
    if (file_exists('ylogs/500')) {
        FileSystem::write('ylogs/500/err_' . date("Ymd.his") . '.log', getOutput($m, true));
    }
    ?>
      <?php 
} else {
    ?>
        <div class="text">
          <?php 
    echo getOutput($m);
    ?>
        </div>
      <?php 
}
?>
    </div>
  </body>
开发者ID:fkali,项目名称:yupp,代码行数:31,代码来源:500.view.php


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