本文整理汇总了PHP中Configurator::writeCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Configurator::writeCode方法的具体用法?PHP Configurator::writeCode怎么用?PHP Configurator::writeCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Configurator
的用法示例。
在下文中一共展示了Configurator::writeCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chdir
chdir(__DIR__ . '/..');
// Use default autoload implementation
require 'vendor/mindaphp/Loader.php';
// Load the libraries
require 'config/loader.php';
// Load the config parameters
$filename = 'config/config.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$code = Configurator::loadCode($filename);
$config = Configurator::parseConfig($code);
$config = Configurator::mergePost($config, $_POST);
echo "<pre>";
$success = false;
if (Configurator::testConfig($config)) {
$code = Configurator::generateCode($config);
Configurator::writeCode($filename, $code);
echo "\nConfig written\n";
$success = true;
} else {
echo "\nConfig not written (invalid)\n";
}
echo "</pre>";
if ($success) {
echo '<input type="button" value="OK" onClick="window.location.href=window.location.href">';
} else {
echo '<input type="button" value="Back" onClick="history.go(-1)">';
}
die;
}
$code = Configurator::loadCode($filename);
$config = Configurator::parseConfig($code);