本文整理汇总了PHP中Magento\Framework\Filesystem\Directory\Write::readFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Write::readFile方法的具体用法?PHP Write::readFile怎么用?PHP Write::readFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Filesystem\Directory\Write
的用法示例。
在下文中一共展示了Write::readFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getDefaultValue
/**
* Return content of default robot.txt
*
* @return bool|string
*/
protected function _getDefaultValue()
{
if ($this->_directory->isFile($this->_file)) {
return $this->_directory->readFile($this->_file);
}
return false;
}
示例2: replaceTmpEncryptKey
/**
* @param string $key
* @return $this
*/
public function replaceTmpEncryptKey($key)
{
$localXml = $this->_configDirectory->readFile($this->_localConfigFile);
$localXml = str_replace(self::TMP_ENCRYPT_KEY_VALUE, $key, $localXml);
$this->_configDirectory->writeFile($this->_localConfigFile, $localXml);
return $this;
}
示例3: loadPackagesForUpdateFromCache
/**
* Load composer packages available for update from cache
*
* @return bool|string
*/
private function loadPackagesForUpdateFromCache()
{
if ($this->directory->isExist($this->pathToCacheFile) && $this->directory->isReadable($this->pathToCacheFile)) {
try {
$data = $this->directory->readFile($this->pathToCacheFile);
return json_decode($data, true);
} catch (\Magento\Framework\Exception\FileSystemException $e) {
}
}
return false;
}
示例4: _addSitemapToRobotsTxt
/**
* Add sitemap file to robots.txt
*
* @param string $sitemapFileName
* @return void
*/
protected function _addSitemapToRobotsTxt($sitemapFileName)
{
$robotsSitemapLine = 'Sitemap: ' . $this->getSitemapUrl($this->getSitemapPath(), $sitemapFileName);
$filename = 'robots.txt';
$content = '';
if ($this->_directory->isExist($filename)) {
$content = $this->_directory->readFile($filename);
}
if (strpos($content, $robotsSitemapLine) === false) {
if (!empty($content)) {
$content .= $this->_findNewLinesDelimiter($content);
}
$content .= $robotsSitemapLine;
}
$this->_directory->writeFile($filename, $content);
}
示例5: getContents
/**
* Get contents of export file
*
* @return string
*/
public function getContents()
{
return $this->_directoryHandle->readFile($this->_destination);
}