本文整理汇总了PHP中ConfigFile::save方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigFile::save方法的具体用法?PHP ConfigFile::save怎么用?PHP ConfigFile::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigFile
的用法示例。
在下文中一共展示了ConfigFile::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
public function actionCreate()
{
$model = new ConfigFile();
if (isset($_POST['ConfigFile'])) {
$model->attributes = $_POST['ConfigFile'];
if ($model->save()) {
Yii::log('Created config file entry ' . $model->id);
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('view', array('model' => $model));
}
示例2: saveConfigFile
/**
* Saves the configuration file.
*
* @param string $code
*/
public static function saveConfigFile($code)
{
return ConfigFile::save($code);
}
示例3: array
$db->insert("settings", array("setting" => "website_email", "value" => $_POST['admin_email']));
$db->insert("settings", array("setting" => "website_lang", "value" => "en_US"));
$db->insert("settings", array("setting" => "show_archive", "value" => "true"));
$conf = new ConfigFile();
$config = array();
$config['db'] = array();
$config['security'] = array();
$config['db']['name'] = $creds['database'];
$config['db']['username'] = $creds['username'];
$config['db']['password'] = $creds['password'];
$config['db']['server'] = $creds['host'];
$config['security']['salt_1'] = generateSalt();
$config['security']['salt_2'] = generateSalt();
$config['security']['salt_3'] = generateSalt();
$conf->writeConfigArray($config);
$conf->save();
$path = dirname(__FILE__) . "/";
$htaccess = "\nErrorDocument 400 " . $path . "error.php?error_code=400\nErrorDocument 401 " . $path . "error.php?error_code=401\nErrorDocument 403 " . $path . "error.php?error_code=403\nErrorDocument 404 " . $path . "error.php?error_code=404\nErrorDocument 500 " . $path . "error.php?error_code=500\nErrorDocument 503 " . $path . "error.php?error_code=503\n";
$b = @file_put_contents(".htaccess", $htaccess);
if (!$b) {
die("Check if you CHMODDED .htaccess to 777. Can't edit it.");
}
$adminPW = generateSalt();
$hash = sha1($config['security']['salt_2'] . $adminPW . $config['security']['salt_3'] . $config['security']['salt_1']);
$db->insert("users", array("id" => 1, "name" => $_POST['username'], "email" => $_POST['admin_email'], "password" => $hash, "rank" => 3, "activated" => 1));
$styleSettings = array("logo_url" => $_POST['website_url'] . "/themes/monk/images/logo.png", "footer_1_title" => "Footer 1", "footer_2_title" => "Footer 2", "footer_3_title" => "Footer 3", "footer_4_title" => "Footer 4", "footer_1_text" => "You can change this in your admin panel!", "footer_2_text" => "You can change this in your admin panel!", "footer_3_text" => "You can change this in your admin panel!", "footer_4_text" => "You can change this in your admin panel!");
foreach ($styleSettings as $setting => $value) {
$db->insert("style_data", array("style_main_class" => "MonkStyle", "setting" => $setting, "setting_type" => "string", "setting_value" => $value));
}
?>
<html>