本文整理汇总了PHP中create_file函数的典型用法代码示例。如果您正苦于以下问题:PHP create_file函数的具体用法?PHP create_file怎么用?PHP create_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_file函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compare_array_in_html_js
function compare_array_in_html_js($fileName, $arr1, $arr2, $title = 'compare_array', $overWrite = false)
{
$content = "";
$jsArr1 = json_encode($arr1);
$jsArr2 = json_encode($arr2);
$content .= "\r\n\t\t<html>\r\n\t\t<head><title>" . $title . "</title></head>\r\n\t\t<body>\r\n\t\t\t<script type='text/javascript'>\r\n\t\t\tvar jsArr1 = " . $jsArr1 . ";\r\n\t\t\t\r\n\t\t\tvar jsArr2 = " . $jsArr2 . "\r\n\t\t\tdocument.write(jsArr1);\r\n\t\t\tdocument.write(jsArr2);\r\n\t\t\t</script>\r\n\t\t</body>\r\n\t\t</html>\r\n\t";
create_file($fileName, $content, $overWrite);
}
示例2: validate_post
function validate_post()
{
if (isset($_POST['input_first_name']) && isset($_POST['input_last_name']) && isset($_POST['input_birthday']) && isset($_POST['input_email']) && isset($_POST['input_telephone'])) {
output_post();
create_file();
} else {
echo "<h1>Error! Required fields are not filled!<h1>";
}
}
示例3: html
/**
* This contains all html specific functions
* @version $Id: html.php 40 2011-02-09 14:10:00Z biyi $
* @package Platform
* @category Function
* @author Biyi Akinpelu
* @link mailto:biyi@entilda.com
* @copyright Copyright (C) 2011 - 2012 The Platform Authors. All rights reserved.
* @license GNU Public Licence, see LICENSE.php
* Platform is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
function html($title = 'Test Application', $file = 'index.html')
{
ob_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<title><?php
echo $title;
?>
</title>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:400,500,700,regular,bold&subset=Latin">
<link rel="stylesheet" type="text/css" href="assets/css/app.css" />
<?php
js_add_jquery();
?>
</head>
<body>
<h1>Hello World</h1>
<p>This is a sample test application.</p>
<p>Edit this content as you wish.</p>
<p>Enjoy!</p>
<div id="overlay_canvas">
<div id="app">
<span class="logo" style="background: transparent url('<?php
echo image_data_uri("assets/images/icons/application-128x128.png", "png");
?>
') no-repeat;"></span><span class="navigator text"><?php
echo $title;
?>
</span>
</div>
</div>
<?php
js_add('assets/js/app.js');
?>
</body>
</html>
<?php
$html = ob_get_clean();
create_file($file, $html);
}
示例4: generate_application
function generate_application($app_path)
{
$app_name = strtolower(end(split(DIRECTORY_SEPARATOR, $app_path)));
$app_real_path = realpath($app_path);
p('info', sprintf('will generate application %s in %s ', ucfirst($app_name), $app_real_path));
create_folder($app_real_path);
foreach (array('app', 'public', 'config', 'vendor', 'lib', 'log') as $f) {
create_folder(make_path($app_real_path, $f));
}
$medick_path = realpath(make_path(dirname(__FILE__), '..'));
create_file($app_real_path, 'boot.php', 'boot.php', array('app_real_path' => $app_real_path, 'medick_path' => $medick_path));
create_file($app_real_path, 'config.xml', make_path('config', $app_name . '.xml'), array('app_name' => $app_name, 'app_real_path' => $app_real_path));
create_file($app_real_path, 'htaccess', make_path('public', '.htaccess'), array('app_name' => $app_name));
create_file($app_real_path, 'index.php', make_path('public', 'index.php'), array('app_name' => $app_name, 'app_real_path' => $app_real_path));
touch(make_path($app_real_path, 'log', 'localhost.log'));
chmod(make_path($app_real_path, 'log', 'localhost.log'), 0777);
exit;
}
示例5: Editor_CreateDirContent
function Editor_CreateDirContent($d)
{
$tplDir = $this->TemplatesDir();
$index = get_file($tplDir . '/index');
$up = content_get_up_to_root($d);
$index = preg_replace('/\\$\\{up_to_root\\}/', $up, $index);
create_file($d . '/index.php', $index);
for ($i = 0; $i < count($this->scripts); $i++) {
$s = $this->scripts[$i];
$mk = dirname($s['file']);
if ($mk != '' && $mk != '.' && !file_exists($d . '/' . $mk)) {
mkdir($d . '/' . $mk);
chmod($d . '/' . $mk, 0775);
}
$src = get_file($tplDir . '/' . $s['script']);
if (preg_match('/index\\.php$/', $s['file'])) {
$src = preg_replace('/\\$\\{up_to_root\\}/', $up, $src);
}
create_file($d . '/' . $s['file'], $src);
}
}
示例6: write_csv
function write_csv()
{
global $programme_fields;
global $programme_docs;
$folder_name = '_executive_programme/';
$displayDate = strftime("%Y-%m-%d");
$displayTime = strftime("%H:%M:%S");
$filename = $folder_name . $displayDate . '.txt';
$data = '';
foreach ($programme_fields as $name => $options) {
$data .= '"' . echo_value($name) . '",';
}
foreach ($programme_docs as $name => $label) {
if (isset($_POST[$name])) {
$data .= '"' . $label . '"' . ',';
} else {
$data .= ',';
}
}
$r = create_file($folder_name, $filename);
$s = $displayDate . ',' . $displayTime . ',';
$s .= $data . "\r\n";
$r = write_file($filename, $s);
}
示例7: time
Author: Quoc Viet [aFeLiOn]
Begin: 2006-04-02
Comment:
--------------------------------------------------------------------------------
*/
if (!defined('IN_EPS')) {
exit;
}
$cur_time = time();
$today_str = date_string($cur_time + $eps_user['timezone'], false);
$tomorrow_str = date_string($cur_time + $eps_user['timezone'] + 86400 * 2, false);
@(include EPS_CACHE_DIR . 'cache_birth.php');
if (empty($eps_births) || !isset($eps_births['date']) || $eps_births['date'] != $today_str) {
$eps_births = array('date' => $today_str, 'today' => array(), 'tomor' => array());
$result = $epsclass->db->query("SELECT name,DATE_FORMAT(birth,'%m%d') as date FROM " . TBL_K48HTD . " WHERE DATE_FORMAT(birth,'%m%d')='{$today_str}' OR DATE_FORMAT(birth,'%m%d')='{$tomorrow_str}'") or error('Unable to fetch student\'s birthday', __FILE__, __LINE__, $epsclass->db->error());
if ($epsclass->db->num_rows($result)) {
while ($cur_std = $epsclass->db->fetch_assoc($result)) {
if ($cur_std['date'] == $today_str) {
$eps_births['today'][] = $cur_std['name'];
} else {
$eps_births['tomor'][] = $cur_std['name'];
}
}
}
$epsclass->db->free_result($result);
create_file('<?php' . "\n" . '$eps_births = ' . var_export($eps_births, true) . ';' . "\n" . '?>', 'cache_birth.php', EPS_CACHE_DIR);
}
$smarty->assign('birth_list', $eps_births['today']);
$smarty->assign('t_birth_list', $eps_births['tomor']);
$smarty->display('module/birth.tpl');
示例8: file_get_contents
<?php
} else {
//连接数据库
$sql = file_get_contents($sqlfile);
//前置表前辍
if ($name == 'system') {
$sql = str_replace("{TableAdmin}", $mysql_admin, $sql);
$sql = str_replace("{TablePass}", md5($mysql_pass), $sql);
}
$sql = str_replace("{TableSysPre}", $mysql_manpre, $sql);
$sql = str_replace("{TableModPre}", $mysql_modpre, $sql);
$sql = str_replace("{TableBase}", url_base(), $sql);
$array = Database::query($sql, $dbcharset);
if (!$array["error"]) {
//写入锁
create_file($lock, date("Y-m-d H:i:s"));
} else {
//安装出错
foreach ($array["fail"] as $arr) {
//出错了
$error = true;
?>
<p><?php
echo $arr['query'] . '<br />' . $arr['error'];
?>
</p>
<?php
}
//安装成功
示例9: create_config_file
function create_config_file()
{
global $epsclass;
// Get the forum config from the DB
$result = $epsclass->db->query('SELECT * FROM ' . TBL_CONFIG, true) or error('Unable to fetch forum config', __FILE__, __LINE__, $epsclass->db->error());
while ($cur_config_item = $epsclass->db->fetch_row($result)) {
$output[$cur_config_item[0]] = $cur_config_item[1];
}
$epsclass->db->free_result($result);
create_file('<?php' . "\n" . 'define(\'CONFIG_LOADED\', true);' . "\n" . '$eps_config = ' . var_export($output, true) . ';' . "\n" . '?>', FILE_CACHE_CONFIG, true);
}
示例10: array
$epsclass->db->vupdate(TBL_NEWS, $updates, $nid);
} else {
if ($action == 'post') {
$inserts = array('title' => $title, 'content' => $content, 'imgurl' => $imgurl, 'poster_id' => $eps_user['id'], 'post_time' => time(), 'type' => $type);
$epsclass->db->vinsert(TBL_NEWS, $inserts);
}
}
// Gen RSS
$epsclass->load_class('class_xml');
$result = $epsclass->db->query("SELECT u.username, n.id,n.title,n.content,n.post_time FROM " . TBL_NEWS . " n LEFT JOIN " . TBL_USER . " u ON n.poster_id=u.id ORDER BY post_time DESC LIMIT 15");
$rss = array();
while ($cur_rss = $epsclass->db->fetch_assoc($result)) {
$rss[] = array('title' => html_clean($cur_rss['title']), 'link' => $eps_config['base_url'] . 'index.php?nid=' . $cur_rss['id'], 'description' => $epsclass->bbcode->format($cur_rss['content'], 600), 'author' => html_clean($cur_rss['username']), 'pubDate' => format_time($cur_rss['post_time']));
}
$epsclass->db->free_result($result);
create_file($epsclass->xml->gen_rss($rss), 'eps_news.xml', EPS_DATA_DIR);
$epsclass->antiflood->update('post', 1);
redirect('index.php', $eps_lang['Redirect_news_' . $action]);
} else {
$errors = $epsclass->validate->errors;
$epsclass->validate->data_reset();
}
}
}
// For Select Box
$news['type'] = isset($type) ? $type : $news['type'];
$news['no_smiley'] = isset($no_smiley) ? $no_smiley : $news['no_smiley'];
if ($action == 'edit') {
$page_title = $eps_lang['Page_post_edit'];
} else {
if ($action == 'delete') {
示例11: form
public static function form($appid, $list)
{
global $_G;
$sql = "SELECT * FROM `mod:form_form` WHERE appid='" . $appid . "' ";
//读取表单信息
$list && ($sql .= " and id in(" . $list . ")");
//创建子文件夹
$folder = create_dir(self::direct($appid));
$result = System::$db->getAll($sql);
foreach ($result as $form) {
$file = $folder . "/form." . $form['id'] . ".php";
$part = array('form' => array(), 'group' => array(), 'option' => array());
//表单主体
foreach ($form as $key => $val) {
if ($key == 'config') {
$form[$key] = fix_json($val);
}
}
$part['form'] = $form;
////////////////
//选项组
$sql = "SELECT * FROM `mod:form_group` WHERE fid=" . $form['id'] . " and `state`>0 order BY sort ASC,id ASC";
$res = System::$db->getAll($sql, 'id');
foreach ($res as $gid => $group) {
foreach ($group as $key => $val) {
if ($key == 'config') {
$group[$key] = fix_json($val);
}
if ($key == 'selected') {
$group[$key] = explode(',', $val);
}
}
$part['group'][$gid] = $group;
}
////////////////
//子选项
$sql = "SELECT * FROM `mod:form_option` WHERE fid=" . $form['id'] . " and `state`>0 order BY sort ASC,id ASC";
$res = System::$db->getAll($sql, 'id');
foreach ($res as $oid => $option) {
foreach ($option as $key => $val) {
if ($key == 'config') {
$option[$key] = fix_json($val);
}
}
$part['option'][$option['gid']][$oid] = $option;
}
////////////////
//写入缓存
create_file($file, '<?php /*' . date("Y-m-d H:i:s") . '*/ $_CACHE[\'' . $appid . '\'] = ' . var_export($part, true) . ';');
}
}
示例12: file_writeblock
function file_writeblock($fn, $data = '')
{
create_file($fn, $data);
}
示例13: substitute
$dec = $return[2][0];
$colors = $return[3][0];
if (file_exists($image))
{
// Create SVG
$svg = substitute($image, $title, $subtitle,
$dec, $colors, (int)$_POST['grad'], $data);
$date = date('Ymd');
$img_path = $location_creation.
$date.$file_title.$file_subtitle;
$json_data = array($_POST, $title, $subtitle, $dec,
$colors, (int)$_POST['grad'], $data);
$return = create_file($svg, $img_path, $json_data);
if (is_int($return))
{
switch ($status)
{
case -1:
$error[] = 'Konnte Datei nicht öffnen. '.
'Keine Zugriffsrechte.';
break;
case -2:
$error[] = 'Konnte Datei nicht schreiben. '.
'Keine Zugriffsrechte.';
break;
case -3:
$error[] = 'Tut uns leid. Es scheinen Parameter '.
'fehlerhaft sein. Konnte die Daten nicht '.
示例14: update
function update($file)
{
global $_CACHE;
$base = self::direct('update');
$sqlfile = $base . $file;
//锁文件
$lock = str_replace(".sql", ".lock", $sqlfile);
if (file_exists($lock)) {
//echo '<div id="state" class="failure">抱歉!安装已经存在。更新于早前已经安装,并在使用中:<span class="text-key">'.$update.'</span></div>';
return 'locked';
} else {
if (file_exists($sqlfile)) {
//日志开始时间
$time = time();
$text = sreadfile($sqlfile);
/////////////////////////////
//获取全部参数
preg_match_all("/#\\[module=(.*?)\\](.+?)#\\[\\/module\\]/ism", $text, $match);
//遍历模块
foreach ($match[1] as $index => $appid) {
//不存在此模块
if (array_key_exists($appid, $_CACHE['system']['module']) === FALSE) {
//从更新语句中移除,#[module=appid]...#[/module]
$text = str_replace($match[0][$index], '', $text);
}
}
/////////////////////////////
$res = self::query($text);
if ($res['error'] == 0) {
//写入锁
create_file($lock, date("Y-m-d H:i:s"));
//写入日志
System::insert_event($func, $time, time(), "安装更新:" . $file);
//搜索模块
//Module :: search();
//缓存系统用户组
//Cached :: table( 'system', 'sys:group', array( 'jsonde' => array('config') ) );
//echo '<div id="state">恭喜!成功安装更新:'.$update.'</div>';
return 'success';
} else {
//echo '<div id="state" class="failure">抱歉!安装更新失败。以下是本错误信息详细报告:</div>';
return 'abort';
}
}
}
}
示例15: create_dir
<?php
create_dir($target_dir);
$out = array();
$tmp_dir = path(dirname(__DIR__), 'assets');
$base_dir = path($tmp_dir, 'static');
\IO\Dir::each($base_dir, '*', function ($file) use($target_dir, $base_dir) {
$new = str_replace($base_dir . DIRECTORY_SEPARATOR, '', $file);
$out = path($target_dir, $new);
if (!is_dir($file)) {
$path = dirname($out);
if (!is_dir($path)) {
status('create', $path);
mkdir($path, 0755, TRUE);
}
status('copy', $out);
copy($file, $out);
}
});
copy_file(path($target_dir, 'assets', 'css'), path($tmp_dir, 'sauce.less'));
copy_file(path($target_dir, 'assets', 'css'), path($tmp_dir, 'base.less'));
copy_file(path($target_dir, 'assets', 'css'), path($tmp_dir, 'media.less'));
copy_file(path($target_dir, 'assets', 'css'), path($tmp_dir, 'styles.css.less'));
copy_file(path($target_dir, 'assets', 'js', 'lib'), path($tmp_dir, 'console.js'));
copy_file(path($target_dir, 'assets', 'js', 'lib'), path($tmp_dir, 'jquery.min.js'));
copy_file(path($target_dir, 'assets', 'js', 'lib'), path($tmp_dir, 'modernizr.min.js'));
copy_file(path($target_dir, 'assets', 'js'), path($tmp_dir, 'script.js.coffee'));
$name = camelcase(basename($target_dir));
create_file(path($target_dir, '.gitignore'), ".cache\nstatic/*");
create_file(path($target_dir, 'config.php'), '<' . "?php\n\n\$config['title'] = '{$name}';\n\$config['base_url'] = '';\n");