本文整理汇总了PHP中Bitrix\Main\IO\File::putFileContents方法的典型用法代码示例。如果您正苦于以下问题:PHP File::putFileContents方法的具体用法?PHP File::putFileContents怎么用?PHP File::putFileContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Main\IO\File
的用法示例。
在下文中一共展示了File::putFileContents方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveRules
private static function saveRules($siteId, array $arUrlRewrite)
{
$site = SiteTable::getRow(array("filter" => array("LID" => $siteId)));
$docRoot = $site["DOC_ROOT"];
if (!empty($docRoot)) {
$docRoot = IO\Path::normalize($docRoot);
} else {
$docRoot = Application::getDocumentRoot();
}
$data = var_export($arUrlRewrite, true);
IO\File::putFileContents($docRoot . "/urlrewrite.php", "<" . "?php\n\$arUrlRewrite=" . $data . ";\n");
Application::resetAccelerator();
}
示例2: clearLogFile
public function clearLogFile()
{
$logDir = $this->getLogFileDir();
if (!Main\IO\Directory::isDirectoryExists($logDir)) {
Main\IO\Directory::createDirectory($logDir);
}
$logFile = $this->getLogFilePath();
Main\IO\File::putFileContents($logFile, '');
}
示例3: bindTemplate
/**
* Binds (and creates if it's necessary) template to the application folder
*
* @param $templateId - symbolic code of the template
* @param $folder - the application folder
* @param bool $createNew - flag of the necessity of creating a new template
*/
public static function bindTemplate($templateId, $folder, $createNew)
{
$arFields = array("TEMPLATE" => array());
if ($createNew) {
CopyDirFiles(Application::getDocumentRoot() . "/bitrix/modules/mobileapp/templates/default_app/", Application::getDocumentRoot() . "/bitrix/templates/" . $templateId, True, True);
File::putFileContents(Application::getDocumentRoot() . "/bitrix/templates/" . $templateId . "/description.php", str_replace(array("#mobile_template_name#"), array($templateId), File::getFileContents(Application::getDocumentRoot() . "/bitrix/templates/" . $templateId . "/description.php")));
$arFields["TEMPLATE"][] = array("SORT" => 1, "CONDITION" => "CSite::InDir('/" . $folder . "/')", "TEMPLATE" => $templateId);
}
$default_site_id = \CSite::GetDefSite();
if ($default_site_id) {
$dbTemplates = \CSite::GetTemplateList($default_site_id);
$arFields["LID"] = $default_site_id;
$isTemplateFound = false;
while ($template = $dbTemplates->Fetch()) {
$arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
if ($template["TEMPLATE"] == $templateId && !$createNew && !$isTemplateFound) {
$isTemplateFound = true;
$arFields["TEMPLATE"][] = array("SORT" => 1, "CONDITION" => "CSite::InDir('/" . $folder . "/')", "TEMPLATE" => $templateId);
}
}
$obSite = new \CSite();
$obSite->Update($default_site_id, $arFields);
}
}
示例4: update
/**
* @param $templateName
* @param $html
* @return bool|int
*/
public static function update($templateName, $html)
{
$result = false;
$fullPathOfFile = \Bitrix\Main\Loader::getLocal(static::LOCAL_DIR_TMPL . bx_basename($templateName) . '.php');
if ($fullPathOfFile) {
$result = File::putFileContents($fullPathOfFile, $html);
}
return $result;
}
示例5: configureLicenseKey
/**
* Sets license key Bitrix CMS.
*
* @param InputInterface $input
* @param OutputInterface $output
* @param string $licenseKey
*/
protected function configureLicenseKey(InputInterface $input, OutputInterface $output, $licenseKey)
{
if (!is_string($licenseKey)) {
throw new \InvalidArgumentException('Config "licenseKey" must be string type.');
}
$licenseFileContent = "<" . "? \$" . "LICENSE_KEY = \"" . EscapePHPString($licenseKey) . "\"; ?" . ">";
File::putFileContents(Application::getDocumentRoot() . BX_ROOT . '/license_key.php', $licenseFileContent);
}
示例6: writeFileLog
/**
* Writes query text and part of backtrace into log file.
*
* @param string $sql Query to be dumped.
* @param float $executionTime Query time.
* @param string $additional Additional info string to be added to header.
* @param integer $traceSkip How many backtrace frames to skip in output.
*
* @return void
* @see \Bitrix\Main\Diag\SqlTracker->startFileLog
* @see \Bitrix\Main\Diag\SqlTracker->stopFileLog
*/
public function writeFileLog($sql, $executionTime = 0.0, $additional = "", $traceSkip = 2)
{
if ($this->logFilePath) {
$header = "TIME: " . round($executionTime, 6) . " SESSION: " . session_id() . " " . $additional . "\n";
$headerLength = strlen($header);
$body = $this->formatSql($sql);
$trace = $this->formatTrace(\Bitrix\Main\Diag\Helper::getBackTrace($this->depthBackTrace, null, $traceSkip));
$footer = str_repeat("-", $headerLength);
$message = "\n" . $header . "\n" . $body . "\n\n" . $trace . "\n" . $footer . "\n";
\Bitrix\Main\IO\File::putFileContents($this->logFilePath, $message, \Bitrix\Main\IO\File::APPEND);
}
}