当前位置: 首页>>代码示例>>PHP>>正文


PHP WriteFile函数代码示例

本文整理汇总了PHP中WriteFile函数的典型用法代码示例。如果您正苦于以下问题:PHP WriteFile函数的具体用法?PHP WriteFile怎么用?PHP WriteFile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WriteFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uninstall

    public static function uninstall()
    {
        global $db, $setting, $admin_cat;
        $info = self::info();
        $db->delete($setting['db']['pre'] . "ticket");
        $db->exec("drop", "table", $setting['db']['pre'] . "ticket");
        $db->delete($setting['db']['pre'] . "admin_cat", array("file", "=", "ticket.php"));
        $db->delete($setting['db']['pre'] . "plugin", array("idx", "=", $info['idx']));
        deleteCache("admin_cat");
        deleteCache("plugin");
        $content = "<?PHP\r\n\$ticket_list = array();\t\t\t\r\n?>";
        WriteFile(dirname(__FILE__) . "/list.php", $content, "wb");
        $err = array();
        if ($db->GetError($err)) {
            showInfo($setting['language']['plugin_err_uninstall'] . "\r\n\t\t\t<br />\r\n\t\t\t<pre>\r\n\t\t\t" . join("\n------------------------\n", $err) . "\r\n\t\t\t</pre>\r\n\t\t\t");
        } else {
            includeCache("admin_cat");
            $admin_cat = toJson($admin_cat, $setting['gen']['charset']);
            echo <<<mystep
<script language="javascript">
parent.admin_cat = {$admin_cat};
parent.setNav();
</script>
mystep;
            buildParaList("plugin");
            echo showInfo($setting['language']['plugin_uninstall_done'], false);
        }
    }
开发者ID:laiello,项目名称:mystep-cms,代码行数:28,代码来源:class.php

示例2: showInfo

     if (count($_POST) == 0) {
         $goto_url = $setting['info']['self'];
     } else {
         if (!preg_match("/^(select|show).+/i", $_POST['sql']) || preg_match("/ into /i", $_POST['sql'])) {
             showInfo($setting['language']['plugin_custom_sql_error_sql']);
         } else {
             unset($_POST['id']);
             if ($method == "add_ok") {
                 $log_info = $setting['language']['plugin_custom_sql_add'];
                 $sql_list[] = $_POST;
             } else {
                 $log_info = $setting['language']['plugin_custom_sql_edit'];
                 $sql_list[$id] = $_POST;
             }
             $content = "<?PHP\r\n\$sql_list = " . var_export($sql_list, true) . ";\t\t\t\r\n?>";
             WriteFile("sql.php", $content, "wb");
         }
         $goto_url = $setting['info']['self'];
     }
     break;
 case "export":
     $log_info = $setting['language']['plugin_custom_sql_export'];
     $xls = new MyXls();
     $xls->init($sql_list[$id]['name'], $sql_list[$id]['name']);
     $xls->addRow();
     $xls->addCells(explode(",", $sql_list[$id]['fields']));
     $db->Query($sql_list[$id]['sql']);
     while ($record = $db->GetRS()) {
         $xls->addRow();
         $xls->addCells($record);
     }
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:custom_sql.php

示例3: GetFile

                    $update_info['content'][$i] = ".";
                } else {
                    $update_info['content'][$i] = GetFile($the_file);
                    $path_parts = pathinfo($update_info['file'][$i]);
                    if (!empty($cs) && strpos(".php,.tpl,.html,.htm,.sql", $path_parts["extension"]) !== false) {
                        $update_info['content'][$i] = str_ireplace(strtolower($setting['gen']['charset']), strtolower($cs), $update_info['content'][$i]);
                        $update_info['content'][$i] = str_ireplace(strtoupper($setting['gen']['charset']), strtoupper($cs), $update_info['content'][$i]);
                        $update_info['content'][$i] = chg_charset($update_info['content'][$i], $setting['gen']['charset'], $cs);
                    }
                }
            } else {
                $update_info['content'][$i] = "";
            }
        }
        $update = base64_encode(serialize($update_info));
        WriteFile($cache_file, $update, "wb");
    }
    echo $update;
} else {
    $fso = new MyFSO();
    $dir_list = $fso->Get_List($plugin_path);
    $plugin_list = array();
    for ($i = 0, $m = count($dir_list['dir']); $i < $m; $i++) {
        if (file_exists($dir_list['dir'][$i] . "/ignore")) {
            continue;
        }
        if (is_file($dir_list['dir'][$i] . "/info.php")) {
            include $dir_list['dir'][$i] . "/info.php";
            $plugin_list[$info['idx']] = array('name' => $info['name'], 'ver' => $info['ver'], 'intro' => $info['intro']);
        }
    }
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:plugin.php

示例4: RecordLog

	function RecordLog($type=false) {
		if($type == "RANK") {
			$file	= LOG_BATTLE_RANK;
			$log	= @glob(LOG_BATTLE_RANK."*");
			$logAmount = MAX_BATTLE_LOG_RANK;
		} else if($type == "UNION") {
			$file	= LOG_BATTLE_UNION;
			$log	= @glob(LOG_BATTLE_UNION."*");
			$logAmount = MAX_BATTLE_LOG_UNION;
		} else {
			$file	= LOG_BATTLE_NORMAL;
			$log	= @glob(LOG_BATTLE_NORMAL."*");
			$logAmount = MAX_BATTLE_LOG;
		}

		// 古いログを消す
		$i	= 0;
		while($logAmount <= count($log) ) {
			unlink($log["$i"]);
			unset($log["$i"]);
			$i++;
		}

		// 新しいログを作る
		$time	= time().substr(microtime(),2,6);
		$file	.= $time.".dat";

		$head	= $time."\n";//開始時間(1行目)
		$head	.= $this->team0_name."<>".$this->team1_name."\n";//参加チーム(2行目)
		$head	.= count($this->team0)."<>".count($this->team1)."\n";//参加人数(3行目)
		$head	.= $this->team0_ave_lv."<>".$this->team1_ave_lv."\n";//平均レベル(4行目)
		$head	.= $this->result."\n";//勝利チーム(5行目)
		$head	.= $this->actions."\n";//総ターン数(6行目)
		$head	.= "\n";// 改行(7行目)

		WriteFile($file,$head.ob_get_contents());
	}
开发者ID:skyser2003,项目名称:Hall-of-Fame,代码行数:37,代码来源:class.battle.php

示例5: SaveLog

 function SaveLog()
 {
     if ($this->AuctionType == "item") {
         if (!$this->AuctionLog) {
             return false;
         }
         // 30行以下に収める
         while (100 < count($this->AuctionLog)) {
             array_pop($this->AuctionLog);
         }
         foreach ($this->AuctionLog as $log) {
             $string .= $log . "\n";
         }
         WriteFile(AUCTION_ITEM_LOG, $string);
     }
 }
开发者ID:skyser2003,项目名称:Hall-of-Fame,代码行数:16,代码来源:class.auction.php

示例6: elseif

     }
 } elseif ($method == "export") {
     $log_info = $setting['language']['admin_func_backup_export'];
     $dir = ROOT_PATH . "/" . $setting['path']['upload'] . "/tmp/";
     if ($table_name == "all") {
         require ROOT_PATH . "/source/class/myzip.class.php";
         $zipfile = $dir . date("Ymd") . "_db_all.zip";
         $dir = $dir . date("Ymd") . "_db_all/";
         $tbl_list = $db->GetTabs($setting['db']['name']);
         $max_count = count($tbl_list);
         $files = array();
         for ($i = 0; $i < $max_count; $i++) {
             $content = "DROP TABLE IF EXISTS `{$tbl_list[$i]}`;\n\n";
             $content .= $db->GetTabSetting($tbl_list[$i], $setting_sub['db']['name']) . "\n" . $db->GetTabData($setting_sub['db']['name'] . "." . $tbl_list[$i]);
             $files[$i] = $dir . $setting_sub['db']['name'] . "_" . $tbl_list[$i] . ".sql";
             WriteFile($files[$i], $content);
         }
         zip($files, $zipfile, $dir);
         header("Content-type: application/zip");
         header("Accept-Ranges: bytes");
         header("Accept-Length: " . filesize($zipfile));
         header("Content-Disposition: attachment; filename=" . basename($zipfile));
         $content = GetFile($zipfile);
         MultiDel($dir);
         unlink($zipfile);
     } else {
         $content = "DROP TABLE IF EXISTS `{$table_name}`;\n\n";
         $content .= $db->GetTabSetting($table_name) . "\n" . $db->GetTabData($table_name);
         header("Content-type: text/plain");
         header("Accept-Ranges: bytes");
         header("Accept-Length: " . strlen($content));
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:func_backup.php

示例7: DoIt

 public function DoIt($type = "pack", $separator = "|")
 {
     $this->pack_result = array();
     if ($type == "pack") {
         $this->pack_fp = fopen($this->pack_file, "wb");
         if (!$this->pack_fp) {
             die("Error Occurs In Creating Output File !");
         }
         $time = $_SERVER['REQUEST_TIME'];
         if (count($this->file_list) > 0) {
             $this->PackFileList($separator);
         } else {
             $this->PackFile($this->pack_dir, $separator);
         }
         fclose($this->pack_fp);
         if ($_SERVER['REQUEST_TIME'] - $time <= 1) {
             sleep(1);
         }
         WriteFile($this->pack_file, gzcompress(GetFile($this->pack_file), 9));
     } else {
         WriteFile($this->pack_file, gzuncompress(GetFile($this->pack_file)));
         $this->pack_fp = fopen($this->pack_file, "rb");
         if (!$this->pack_fp) {
             die("Error Occurs In Reading Pack File !");
         }
         $this->UnpackFile($this->pack_dir, $separator);
         fclose($this->pack_fp);
         unlink($this->pack_file);
     }
     $filename = $this->pack_file;
     $filesize = GetFileSize($filename);
     array_push($this->pack_result, "<br />File Count: {$this->file_count} File(s)");
     return $filename;
 }
开发者ID:laiello,项目名称:mystep-cms,代码行数:34,代码来源:mypack.class.php

示例8: unset

        } else {
            $content = $_POST['content'];
            if (!preg_match("/^[\r\n\\s]*<\\?php(.+)\\?>[\r\n\\s]*\$/is", $content)) {
                $content = "<?php\n" . $content . "\n?>";
            }
            unset($_POST['content']);
            if ($method == "add_ok") {
                $_POST['idx'] = $_SERVER['REQUEST_TIME'];
                $log_info = $setting['language']['plugin_xcode_add'];
                $mydb->insertDate($_POST, 1);
            } else {
                $log_info = $setting['language']['plugin_xcode_edit'];
                $record = $mydb->queryDate("idx=" . $idx, true, &$fp_pos, &$row_pos);
                $mydb->updateDate($_POST, $row_pos, 1);
            }
            WriteFile(dirname(__FILE__) . "/code/" . $_POST['idx'] . ".php", $content, "wb");
        }
        break;
    default:
        break;
}
if (!empty($log_info)) {
    write_log($log_info, "idx={$idx}");
    $goto_url = $setting['info']['self'];
}
$mydb->closeTBL();
unset($mydb);
$mystep->pageEnd(false);
function build_page($method)
{
    global $mystep, $req, $db, $setting, $idx, $mydb;
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:xcode.php

示例9: count

         }
         $link = "";
         $m = count($list);
         if ($m > 0) {
             require ROOT_PATH . "/source/class/myzip.class.php";
             $dir = ROOT_PATH . "/" . $setting['path']['upload'] . "/tmp/";
             $zipfile = $dir . "update_" . date("Ymd") . ".zip";
             @unlink($zipfile);
             $dir = $dir . "update/" . date("Ymd/");
             $files = array();
             for ($i = 0; $i < $m; $i++) {
                 if ($update_info['content'][$list[$i]] == ".") {
                     continue;
                 }
                 $files[$i] = $dir . $update_info['file'][$list[$i]];
                 WriteFile($files[$i], $update_info['content'][$list[$i]], "wb");
             }
             if (zip($files, $zipfile, $dir)) {
                 $link = $setting['web']['url'] . "/" . $setting['path']['upload'] . "/tmp/" . basename($zipfile);
             }
             MultiDel($dir);
         }
     }
     echo $link;
     break;
 default:
     $header = array();
     $header['Referer'] = "http://" . $req->GetServer("HTTP_HOST");
     $header['ms_sign'] = $setting['web']['sign'];
     $check_info = GetRemoteContent($setting['gen']['update'] . "?m=check&v=" . $ms_version['ver'] . "&cs=" . $setting['gen']['charset'], $header);
     $check_info = chg_charset($check_info, "utf-8", $setting['gen']['charset']);
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:update.php

示例10: SaveRanking

	function SaveRanking() {
		foreach($this->Ranking as $rank => $val) {
			$ranking	.= $val["id"]."\n";
		}

		WriteFile(RANKING,$ranking);
	}
开发者ID:skyser2003,项目名称:Hall-of-Fame,代码行数:7,代码来源:class.rank.php

示例11: MultiDel

    @unlink($target_file);
    MultiDel($result_dir);
    sleep(1);
    mkdir($result_dir);
    $mypack = new MyPack($pack_dir, $pack_file);
    $mypack->AddIgnore(basename(dirname(__FILE__)), ".svn", "web.config", "aspnet_client", "include/install.lock", "Thumbs.db", "bak", "xcache", "_test", "config_test.php", "config-bak.php", "cfna_mis");
    if (!empty($cs)) {
        $mypack->setCharset("gbk", $cs, $lng_type, ".php,.tpl,.html,.htm,.sql");
    }
    $mypack->DoIt();
    //echo $mypack->GetResult();
    $result = "";
    $result .= GetFile("mypack.class.php");
    $result .= "\n";
    $result .= GetFile("setup.php");
    $result = str_replace("?>\n<?php", "", $result);
    WriteFile($target_file, $result, "wb");
    unset($result);
    copy("intro.txt", $result_dir . "/readme.txt");
    require "../source/class/myzip.class.php";
    rename($result_dir, "upload");
    zip("upload", "build/" . $result_dir . ".zip");
    MultiDel("upload");
}
?>
<script language="JavaScript">
location.href = "build/<?php 
echo $result_dir;
?>
.zip";
</script>
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:index.php

示例12: SaveData

 function SaveData()
 {
     $dir = USER . $this->id;
     $file = USER . $this->id . "/" . DATA;
     if (file_exists($this->file) && $this->fp) {
         //print("BBB");
         //ftruncate($this->fp,0);
         //rewind($this->fp);
         //$fp	= fopen($file,"w+");
         //flock($fp,LOCK_EX);
         //fputs($this->fp,$this->DataSavingFormat());
         WriteFileFP($this->fp, $this->DataSavingFormat());
         fclose($this->fp);
         unset($this->fp);
         //WriteFile("./user/1234/data2.dat",$this->DataSavingFormat());
         //WriteFile($file,$this->DataSavingFormat());
         //WriteFileFP($this->fp,$this->DataSavingFormat());
         //fclose($this->fp);
     } else {
         if (file_exists($file)) {
             WriteFile($file, $this->DataSavingFormat());
         }
     }
 }
开发者ID:skyser2003,项目名称:hof,代码行数:24,代码来源:class.user.php

示例13: mysql_close

            mysql_close($link);
            $new_setting = arrayMerge($setting, $_POST['setting']);
            unset($new_setting['web']['s_user'], $new_setting['web']['s_pass'], $new_setting['web']['cache_mode'], $new_setting['db']['host'], $new_setting['db']['user'], $new_setting['db']['pass'], $new_setting['db']['pconnect'], $new_setting['db']['charset'], $new_setting['gen']['charset'], $new_setting['gen']['gzip_level'], $new_setting['gen']['cache'], $new_setting['gen']['cache_ext'], $new_setting['gen']['timezone'], $new_setting['gen']['update'], $new_setting['gen']['minify'], $new_setting['gen']['etag'], $new_setting['cookie']['path'], $new_setting['cookie']['prefix'], $new_setting['watermark']['position'], $new_setting['watermark']['img_rate'], $new_setting['watermark']['txt_font'], $new_setting['watermark']['txt_fontsize'], $new_setting['watermark']['txt_fontcolor'], $new_setting['watermark']['txt_bgcolor'], $new_setting['watermark']['alpha'], $new_setting['watermark']['credit'], $new_setting['rewrite'], $new_setting['email'], $new_setting['js'], $new_setting['list'], $new_setting['session'], $new_setting['path'], $new_setting['content'], $new_setting['memcache']);
            $result = <<<mystep
<?php
\$setting_sub = array();

/*--settings--*/
?>
mystep;
            $result = str_replace("/*--settings--*/", makeVarsCode($new_setting, '$setting_sub'), $result);
            WriteFile(ROOT_PATH . "/include/config_main.php", $result, "w");
        }
        break;
    case 4:
        WriteFile("../include/install.lock", date("Y-m-d H:i:s"));
        $header = array();
        $header['Referer'] = "http://" . $req->GetServer("HTTP_HOST");
        $header['ms_sign'] = $setting['web']['sign'];
        $code = GetRemoteContent($setting['gen']['update'] . "/install.php?v=" . $ms_version['ver'] . "&cs=" . $setting['gen']['charset'] . "&email=" . urlencode($setting['web']['email']) . "&title=" . urlencode($setting['web']['title']), $header);
        break;
    default:
        break;
}
echo <<<mystep
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
\t<TITLE>MyStep 安装向导</TITLE>
\t<META content="text/html; charset=gbk" http-equiv=Content-Type>
\t<LINK rel=stylesheet type=text/css href="style.css" media=all>
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:index.php

示例14: explode

            $ip_list = explode("\n", $_POST['ip']);
            unset($_POST['ip'], $_POST['idx_org'], $_POST['keyword']);
            for ($i = 0, $m = count($ip_list); $i < $m; $i++) {
                if (strlen($ip_list[$i]) < 5) {
                    continue;
                }
                $_POST['ip'] = $ip_list[$i];
                $_POST['ip'] = str_replace("\n", "", $_POST['ip']);
                $_POST['count'] = 0;
                if (isset($ip_info[$_POST['ip']])) {
                    $_POST['count'] = $ip_info[$_POST['ip']];
                }
                $db->replace($setting['db']['pre'] . "se_detect", $_POST);
            }
            $content = "<?PHP\r\n\$agent = " . var_export($agent, true) . ";\t\t\t\r\n?>";
            WriteFile("agent.php", $content, "wb");
        }
        break;
    default:
        $goto_url = $setting['info']['self'];
}
if (!empty($log_info)) {
    write_log($log_info, "idx=" . $idx);
    $goto_url = $setting['info']['self'];
}
$mystep->pageEnd(false);
function build_page($method)
{
    global $mystep, $req, $db, $setting, $idx, $agent;
    $tpl_info = array("idx" => "main", "style" => "../plugin/" . basename(realpath(dirname(__FILE__))) . "/tpl/", "path" => ROOT_PATH . "/" . $setting['path']['template']);
    $tpl = $mystep->getInstance("MyTpl", $tpl_info);
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:se_detect.php

示例15: array

        $para_new["rewrite"][] = array($_POST['rule'][$i], $_POST['jump'][$i]);
    }
    changeSetting($setting_new, $para_new);
    if (!empty($_POST['rule_new'])) {
        if ($_POST['write_type'] == "IIS7") {
            if (is_file(ROOT_PATH . "/web.config")) {
                $iis_setting = GetFile(ROOT_PATH . "/web.config");
                if (preg_match("/<rewrite>.+<\\/rewrite>/ism", $iis_setting, $match)) {
                    $iis_setting = str_replace($match[0], $_POST['rule_new'], $iis_setting);
                } else {
                    $iis_setting = str_replace("</system.webServer>", $_POST['rule_new'] . "</system.webServer>", $iis_setting);
                }
                WriteFile(ROOT_PATH . "/web.config", $iis_setting, "wb");
            }
        } else {
            WriteFile(ROOT_PATH . "/.htaccess", $_POST['rule_new'], "wb");
        }
    }
} else {
    $tpl_info['idx'] = "web_rewrite";
    $tpl_tmp = $mystep->getInstance("MyTpl", $tpl_info);
    $tpl_tmp->allow_script = true;
    $tpl_tmp->Set_Variable('title', $setting['language']['admin_web_rewrite_title']);
    for ($i = 0, $m = count($rewrite_list); $i < $m; $i++) {
        $tpl_tmp->Set_Loop("rewrite", array("idx" => $i + 1, "rule" => $rewrite_list[$i][0], "jump" => $rewrite_list[$i][1]));
    }
    $tpl_tmp->Set_Variable('rewrite_1', $setting['rewrite']['enable'] ? "checked" : "");
    $tpl_tmp->Set_Variable('rewrite_2', $setting['rewrite']['enable'] ? "" : "checked");
    $tpl_tmp->Set_Variable('rewrite_read', $setting['rewrite']['read']);
    $tpl_tmp->Set_Variable('rewrite_list', $setting['rewrite']['list']);
    $tpl_tmp->Set_Variable('rewrite_tag', $setting['rewrite']['tag']);
开发者ID:laiello,项目名称:mystep-cms,代码行数:31,代码来源:web_rewrite.php


注:本文中的WriteFile函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。