function update_config( $config )
{
$buffer = array();
$buffer[] = '<?php';
$buffer[] = 'defined(\'_VALID\') or die(\'Restricted Access!\');';
foreach( $config as $key => $value ) {
if ( !preg_match('/^[A-Z_]+/', $key) && !preg_match('/^db_(.*)/', $key) ) {
$buffer[] = '$config[\'' .$key. '\'] = \'' .str_replace('\'', ''', $value). '\';';
}
}
$buffer[] = '?>';
$data = implode("\n", $buffer);
$path = $config['BASE_DIR']. '/include/config.local.php';
$fp = fopen($path, 'wb');
if ($fp) {
flock($fp, LOCK_EX);
$len = strlen($data);
fwrite($fp, $data, $len);
flock($fp, LOCK_UN);
fclose($fp);
}
}
你可能感兴趣的,这个是什么实现原理
分类吗? 还是随机 还是说根据文章 nlp 等处理的?