本文整理汇总了PHP中FileSystem::read方法的典型用法代码示例。如果您正苦于以下问题:PHP FileSystem::read方法的具体用法?PHP FileSystem::read怎么用?PHP FileSystem::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem::read方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
public function actionUpdate($dir, $fileName)
{
if (isset($_POST['fileContent'])) {
FileSystem::write('./'.$dir.'/'.$fileName, $_POST['fileContent'], 'w');
Y::end();
}
$content = '';
$info = FileSystem::getInfo('./'.$dir.'/'.$fileName, array('name', 'ext'));
if (in_array($info['ext'], array('js', 'css'))) {
if (substr($dir, 0, 2) == 'js' || substr($dir, 0, 3) == 'css') {
$content = FileSystem::read('./'.$dir.'/'.$fileName);
}
}
$output = $this->renderPartial('fileDetails', array(
'fileName' => $fileName,
'content' => $content,
'type' => $info['ext'] == 'css' ? 'css' : 'javascript',
'filePath' => './'.$dir.'/'.$fileName
), true);
Y::tab('Содержимое файла', $output);
$output = Y::getTabs('cssFileForm', true);
Y::clientScript()->render($output);
echo CHtml::tag('div', array(), $output);
}
示例2: stream_read
/**
* Read from stream
*/
public function stream_read($count)
{
if (!in_array($this->mode, ['r', 'r+', 'w+', 'a+', 'x+', 'c+'])) {
return FALSE;
}
$data = $this->fileSystem->read($this->getFileName(), $this->fpos, $count);
if ($data === NULL) {
return FALSE;
}
$this->fpos += strlen($data);
return $data;
}
示例3: getTemplate
public function getTemplate()
{
if ($this->_template === null) {
$path = $this->filePath;
$files = FileSystem::dirFileInfo($path);
$fileName = $this->alias.$this->ext;
if (isset($files[$fileName]))
$this->_template = FileSystem::read($path.$fileName);
}
return $this->_template;
}
示例4:
</ul>
</div>
</header>
<section>
<h1>Rediger Nyheder</h1>
<p>Her redigeres i Nyheder på Peter Gift hjemmesiden. <!-- Punkterne gemmes enkeltvis--></p>
</section>
<main id="menupunkter">
<form action="processes/process2.php" method="post">
<section class="formfelt">
<h2>Nyheder</h2>
<h3>Nyheds titel</h3>
<textarea class="nyhedtitel" name="titelnyhed"><?php
// Læs menupunkt
$filename = "includes/nyheder/nyhedstitel.html";
echo $file->read($filename);
?>
</textarea>
<h3>Nyheden</h3>
<textarea class="nyhedtekst" name="tekstnyhed" ><?php
// læs beskrivelse
$filename = "includes/nyheder/nyhedstekst.html";
echo $file->read($filename);
?>
</textarea>
</section>
<button type="submit" class="button">Gem</button>
</form>
示例5: 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);
}
示例6: adminForm
public function adminForm()
{
$dir = 'mainContent.components.widgets.views.MainContent.'.$this->widgetModel->pk.'.';
Y::beginTab('Шаблон списка');
$this->widget('CodeMirror', array(
'type'=>'text/html',
'id'=>'main_content_list_template',
'content'=>FileSystem::read(Yii::getPathOfAlias($dir.'listTemplate').'.twig'),
'name'=>'list-template'
));
Y::endTab();
Y::beginTab('Шаблон элемента');
$this->widget('CodeMirror', array(
'type'=>'text/html',
'id'=>'main_content_item',
'content'=>FileSystem::read(Yii::getPathOfAlias($dir.'item').'.twig'),
'name'=>'item'
));
Y::endTab();
Y::beginTab('Шаблон полный');
$this->widget('CodeMirror', array(
'type'=>'text/html',
'id'=>'main_content_full',
'content'=>FileSystem::read(Yii::getPathOfAlias($dir.'full').'.twig'),
'name'=>'full'
));
Y::endTab();
}