本文整理汇总了PHP中fileWrite函数的典型用法代码示例。如果您正苦于以下问题:PHP fileWrite函数的具体用法?PHP fileWrite怎么用?PHP fileWrite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fileWrite函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: file
/**
* 数据库缓存到本地文件
* @return unknown
*/
public function file()
{
$arrCache = $this->findAll('cache');
foreach ($arrCache as $key => $item) {
fileWrite($item['cachename'] . '.php', 'data', $this->get($item['cachename']));
}
}
示例2: optionsdo
public function optionsdo()
{
//先清空数据
$this->doSql("TRUNCATE TABLE `" . dbprefix . "weibo_options`");
foreach ($_POST['option'] as $key => $item) {
$optionname = $key;
$optionvalue = trim($item);
$this->create('weibo_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue));
}
$arrOptions = $this->findAll('weibo_options', null, null, 'optionname,optionvalue');
foreach ($arrOptions as $item) {
$arrOption[$item['optionname']] = $item['optionvalue'];
}
fileWrite('weibo_options.php', 'data', $arrOption);
$GLOBALS['tsMySqlCache']->set('weibo_options', $arrOption);
qiMsg('修改成功!');
}
示例3: __autoload
function __autoload($class_name)
{
$file = ROOT_PATH . 'include/table/' . $class_name . '.class.php';
if (!file_exists($file)) {
$file = ROOT_PATH . 'include/class/' . $class_name . '.class.php';
if (!file_exists($file)) {
$file = ROOT_PATH . 'include/class/' . $class_name . '/' . $class_name . '.class.php';
if (!file_exists($file)) {
$str = file_get_contents(ROOT_PATH . 'include/template.php');
$str = str_replace('CLASSNAME', $class_name, $str);
fileWrite(ROOT_PATH . 'cache/', 'tmpclass.php', $str);
$file = ROOT_PATH . 'cache/' . 'tmpclass.php';
}
}
}
include_once $file;
}
示例4: defined
<?php
defined('IN_TS') or die('Access Denied.');
switch ($ts) {
//基本配置
case "":
$arrOptions = $new['redeem']->findAll('redeem_options');
foreach ($arrOptions as $item) {
$strOption[$item['optionname']] = stripslashes($item['optionvalue']);
}
include template("admin/options");
break;
case "do":
//先清空数据
$db->query("TRUNCATE TABLE `" . dbprefix . "redeem_options`");
foreach ($_POST['option'] as $key => $item) {
$optionname = $key;
$optionvalue = trim($item);
$new['redeem']->create('redeem_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue));
}
$arrOptions = $new['redeem']->findAll('redeem_options', null, null, 'optionname,optionvalue');
foreach ($arrOptions as $item) {
$arrOption[$item['optionname']] = $item['optionvalue'];
}
fileWrite('redeem_options.php', 'data', $arrOption);
$tsMySqlCache->set('redeem_options', $arrOption);
qiMsg('修改成功!');
break;
}
示例5: defined
defined('IN_TS') or die('Access Denied.');
switch ($ts) {
//角色列表
case "list":
$arrRole = $new['user']->findAll('user_role');
include template('admin/role_list');
break;
//角色修改
//角色修改
case "do":
$arrRoleName = $_POST['rolename'];
$arrScoreStart = $_POST['score_start'];
$arrScoreEnd = $_POST['score_end'];
//先清空
$db->query("TRUNCATE TABLE `" . dbprefix . "user_role`");
//后添加
foreach ($arrRoleName as $key => $item) {
$rolename = trim($item);
$score_start = trim($arrScoreStart[$key]);
$score_end = trim($arrScoreEnd[$key]);
if ($rolename) {
$new['user']->create('user_role', array('rolename' => $rolename, 'score_start' => $score_start, 'score_end' => $score_end));
}
}
//再生成缓存文件
$arrRole = $new['user']->findAll('user_role', null, null, 'rolename,score_start,score_end');
fileWrite('user_role.php', 'data', $arrRole);
$tsMySqlCache->set('user_role', $arrRole);
qiMsg("修改成功!");
break;
}
示例6: array
$new['group']->create('group_user', array('userid' => $iuserid, 'groupid' => $groupid, 'addtime' => time()));
//计算小组会员数
$count_user = $new['group']->findCount('group_user', array('groupid' => $groupid));
//更新小组成员统计
$new['group']->update('group', array('groupid' => $groupid), array('count_user' => $count_user));
//发送系统消息开始
$msg_userid = '0';
$msg_touserid = $iuserid;
$msg_content = '你被邀请加入一个小组,快去看看吧<br />' . tsUrl('group', 'show', array('id' => $groupid));
aac('message')->sendmsg($msg_userid, $msg_touserid, $msg_content);
//发送系统消息end
header('Location: ' . tsUrl('group', 'show', array('id' => $groupid)));
} else {
tsNotice('倒霉了吧?');
}
break;
//usertips
//usertips
case "usertips":
$data = fileRead('data/user_tips.php');
if ($data == '') {
$query = $db->fetch_all_assoc("select * from " . dbprefix . "user_info");
foreach ($query as $user) {
$usertip[] = array('user' => $user['username'], 'name' => $user['userid']);
}
fileWrite('user_tips.php', 'data', json_encode($usertip));
$data = fileRead('data/user_tips.php');
}
echo $data;
break;
}
示例7: store_data
/**
* Writes the data to the config files
*
* @author Chris Smith <chris@jalakai.co.uk>
*/
function store_data($d)
{
global $LC;
$ok = true;
$d['policy'] = (int) $d['policy'];
// create local.php
$now = gmdate('r');
$output = <<<EOT
<?php
/**
* Dokuwiki's Main Configuration File - Local Settings
* Auto-generated by install script
* Date: {$now}
*/
EOT;
$output .= '$conf[\'title\'] = \'' . addslashes($d['title']) . "';\n";
$output .= '$conf[\'lang\'] = \'' . addslashes($LC) . "';\n";
$output .= '$conf[\'license\'] = \'' . addslashes($d['license']) . "';\n";
if ($d['acl']) {
$output .= '$conf[\'useacl\'] = 1' . ";\n";
$output .= "\$conf['superuser'] = '@admin';\n";
}
$ok = $ok && fileWrite(DOKU_LOCAL . 'local.php', $output);
if ($d['acl']) {
// hash the password
$phash = new PassHash();
$pass = $phash->hash_smd5($d['password']);
// create users.auth.php
// --- user:SMD5password:Real Name:email:groups,comma,seperated
$output = join(":", array($d['superuser'], $pass, $d['fullname'], $d['email'], 'admin,user'));
$output = @file_get_contents(DOKU_CONF . 'users.auth.php.dist') . "\n{$output}\n";
$ok = $ok && fileWrite(DOKU_LOCAL . 'users.auth.php', $output);
// create acl.auth.php
$output = <<<EOT
# acl.auth.php
# <?php exit()?>
# Don't modify the lines above
#
# Access Control Lists
#
# Auto-generated by install script
# Date: {$now}
EOT;
if ($d['policy'] == 2) {
$output .= "* @ALL 0\n";
$output .= "* @user 8\n";
} elseif ($d['policy'] == 1) {
$output .= "* @ALL 1\n";
$output .= "* @user 8\n";
} else {
$output .= "* @ALL 8\n";
}
$ok = $ok && fileWrite(DOKU_LOCAL . 'acl.auth.php', $output);
}
return $ok;
}
示例8: defined
<?php
defined('IN_TS') or die('Access Denied.');
//插件编辑
switch ($ts) {
//编辑
case "set":
$arrData = fileRead('data/plugins_pubs_wordad.php');
if ($arrData == '') {
$arrData = $tsMySqlCache->get('plugins_pubs_wordad');
}
include 'edit.html';
break;
//执行编辑
//执行编辑
case "do":
$arrTitle = $_POST['title'];
$arrUrl = $_POST['url'];
foreach ($arrTitle as $key => $item) {
$title = trim($item);
$url = trim($arrUrl[$key]);
if ($title && $url) {
$arrData[] = array('title' => $title, 'url' => $url);
}
}
fileWrite('plugins_pubs_wordad.php', 'data', $arrData);
$tsMySqlCache->set('plugins_pubs_wordad', $arrData);
header('Location: ' . SITE_URL . 'index.php?app=pubs&ac=plugin&plugin=wordad&in=edit&ts=set');
break;
}
示例9: mktime
$smarty->caching = false;
$smarty->cache_lifetime = $CONFIG['SMARTY_CACHE_LIFETIME'];
$smarty->template_dir = '../tpl';
$smarty->compile_dir = '../cache/tpl_c';
$smarty->cache_dir = '../cache/html';
$smarty->assign('PHPDL_INSTALLED', mktime());
$smarty->assign('DB_HOST', $DB_HOST);
$smarty->assign('DB_NAME', $DB_NAME);
$smarty->assign('DB_USER', $DB_USER);
$smarty->assign('DB_PASS', $DB_PASS);
$smarty->assign('WGET', $WGET);
$smarty->assign('PS', $PS);
$smarty->assign('USER_PASSWORD_SALT', $USER_PASSWORD_SALT);
$smarty->assign('USER_SESSION_TTL', $USER_SESSION_TTL);
if (fileWrite($CONFIG_PATH, $smarty->fetch($CONFIG_TPL_PATH))) {
if (fileWrite('INSTALLED', date('Y-m-d H:i:s'))) {
htmlInstallFinished();
}
} else {
print '<b><font color="#cc0000">Installation failed</font></b>';
}
} else {
print '<b><font color="#cc0000">Installation failed. No Smarty available!</font></b>';
}
htmlFooter();
break;
case 'mysqlCheckConnection':
$_SESSION['DB_HOST'] = $_GET['DB_HOST'];
$_SESSION['DB_NAME'] = $_GET['DB_NAME'];
$_SESSION['DB_USER'] = $_GET['DB_USER'];
$_SESSION['DB_PASS'] = $_GET['DB_PASS'];
示例10: defined
<?php
defined('IN_TS') or die('Access Denied.');
switch ($ts) {
//配置
case "":
$arrOptions = $new['user']->findAll('user_options');
foreach ($arrOptions as $item) {
$strOption[$item['optionname']] = $item['optionvalue'];
}
include template("admin/options");
break;
//配置执行
//配置执行
case "do":
//先清空数据
$db->query("TRUNCATE TABLE `" . dbprefix . "user_options`");
foreach ($_POST['option'] as $key => $item) {
$optionname = $key;
$optionvalue = trim($item);
$new['user']->create('user_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue));
}
$arrOptions = $new['user']->findAll('user_options', null, null, 'optionname,optionvalue');
foreach ($arrOptions as $item) {
$arrOption[$item['optionname']] = $item['optionvalue'];
}
fileWrite('user_options.php', 'data', $arrOption);
$tsMySqlCache->set('user_options', $arrOption);
qiMsg("用户APP配置成功!");
break;
}
示例11: foreach
//生成缓存
$arrIps = $new['system']->findAll('anti_ip');
foreach ($arrIps as $key => $item) {
$arrIp[] = $item['ip'];
}
fileWrite('system_anti_ip.php', 'data', $arrIp);
$tsMySqlCache->set('system_anti_ip', $arrIp);
}
qiMsg('垃圾IP添加成功!');
} else {
qiMsg('垃圾IP不能为空!');
}
break;
case "ipdel":
$id = intval($_GET['id']);
$new['system']->delete('anti_ip', array('id' => $id));
//生成缓存
$arrIps = $new['system']->findAll('anti_ip');
foreach ($arrIps as $key => $item) {
$arrIp[] = $item['ip'];
}
fileWrite('system_anti_ip.php', 'data', $arrIp);
$tsMySqlCache->set('system_anti_ip', $arrIp);
qiMsg('删除成功!');
break;
//云词
//云词
case "cloud":
include template('anti_cloud');
break;
}
示例12: main
function main()
{
global $CONFIG, $SCHEDULER_LAST;
print "\n";
printd("start\n");
printd("cwd: " . getcwd() . "\n");
$date = date('Ymd');
fileWrite($CONFIG['PHPDL_STACK_PIDFILE'], posix_getpid());
$n = 0;
while (!$SHUTDOWN) {
$n++;
$dbh = dbConnect();
$scheduler = scheduler($dbh);
$filesDownloading = filesDownloading($dbh);
if ($SCHEDULER_LAST != $scheduler) {
plog("scheduler '{$scheduler}' matched\n");
$SCHEDULER_LAST = $scheduler;
}
$res = mysql_query("select id from packets where archive = '0' and active = '1' and ftime = '0' order by sortnr, id;", $dbh);
if (mysql_num_rows($res)) {
while ($row = mysql_fetch_assoc($res)) {
$packet = new dlpacket($CONFIG['DB_HOST'], $CONFIG['DB_NAME'], $CONFIG['DB_USER'], $CONFIG['DB_PASS']);
if ($packet->loadById($row['id'])) {
$packetDirBn = getPacketFilename($packet->get('id'), $packet->get('name'));
$packetDownloadDir = 'downloads/loading/' . $packetDirBn;
$packetFinishedDir = 'downloads/finished/' . $packetDirBn;
if ($packet->loadFiles()) {
if ($packet->filesUnfinished()) {
if ($scheduler > 0) {
if ($filesDownloading < $CONFIG['DL_SLOTS']) {
if (!$packet->get('stime')) {
$packet->save('stime', mktime());
}
if ($nextfile = $packet->getFileNextUnfinished()) {
while ($nextfile->get('error')) {
printd("nextfile " . $nextfile->get('id') . "\n");
$nextfile = $packet->getFileNextUnfinished();
if (!$nextfile) {
break;
}
sleep(1);
}
if ($nextfile) {
printd("packet " . $packet->get('id') . ": download " . $nextfile->get('id') . "\n");
$sh = 'php wget.php ' . $nextfile->get('id') . ' 1>> log/wget.' . $date . '.log 2>> log/wget.' . $date . '.log &';
printd("exec '{$sh}'\n");
system($sh);
sleep(1);
break;
}
}
} else {
plog("no free download slots (" . $CONFIG['DL_SLOTS'] . ")\n");
}
}
} else {
printd("packet " . $packet->get('id') . ": all files finished\n");
if (!$packet->get('stime')) {
$packet->set('stime', mktime());
}
$packet->save('ftime', mktime());
$packet->md5Verify();
$packet->sizeVerify();
if (!$packet->fileErrors()) {
if (file_exists($packetFinishedDir)) {
$files = scandir($packetDownloadDir);
foreach ($files as $file) {
if ($file != '.' && $file != '..' && file_exists($packetDownloadDir . '/' . $file)) {
rename($packetDownloadDir . '/' . $file, $packetFinishedDir . '/' . $file);
}
}
reset($files);
rmdir($packetDownloadDir);
} else {
rename($packetDownloadDir, $packetFinishedDir);
}
}
}
}
}
unset($packet);
}
} else {
plog("no active download\n");
}
dbClose($dbh);
$SHUTDOWN = shutdownCheck();
sleep(5);
}
shutdown();
}
示例13: qiMsg
qiMsg("插件停用成功!");
} elseif ($isused == '1') {
array_push($app_plugins, $pname);
if (file_exists('plugins/' . $apps . '/' . $pname . '/install.sql')) {
$sql = file_get_contents('plugins/' . $apps . '/' . $pname . '/install.sql');
$sql = str_replace('ts_', '' . dbprefix . '', $sql);
$ret = $db->query($sql);
if ($ret == '1') {
fileWrite($apps . '_plugins.php', 'data', $app_plugins);
$tsMySqlCache->set($apps . '_plugins', $app_plugins);
$msg = '插件启用成功!';
} else {
$msg = $ret;
}
} else {
fileWrite($apps . '_plugins.php', 'data', $app_plugins);
$tsMySqlCache->set($apps . '_plugins', $app_plugins);
$msg = '插件启用成功!';
}
qiMsg($msg);
}
break;
//删除插件
//删除插件
case "delete":
$apps = tsUrlCheck($_GET['apps']);
$pname = tsUrlCheck($_GET['pname']);
delDir('plugins/' . $apps . '/' . $pname);
qiMsg('删除成功!');
break;
}
示例14: array
*/
//导航
case "appnav":
$appkey = $_POST['appkey'];
$appname = $_POST['appname'];
$arrNav = (include 'data/system_appnav.php');
if (is_array($arrNav)) {
$arrNav[$appkey] = $appname;
} else {
$arrNav = array($appkey => $appname);
}
foreach ($arrNav as $key => $item) {
if (!is_dir('app/' . $key)) {
unset($arrNav[$key]);
}
}
fileWrite('system_appnav.php', 'data', $arrNav);
$tsMySqlCache->set('system_appnav', $arrNav);
echo '1';
break;
//取消导航
//取消导航
case "unappnav":
$appkey = $_POST['appkey'];
$arrNav = (include 'data/system_appnav.php');
unset($arrNav[$appkey]);
fileWrite('system_appnav.php', 'data', $arrNav);
$tsMySqlCache->set('system_appnav', $arrNav);
echo '1';
break;
}
示例15: mysqli_query
require_once 'file.php';
$usern = $_SESSION['login_user'];
$conn1 = $_SESSION['conn'];
$quer = $_POST['stext'];
$propic = mysqli_query($conn1, "select picture from user where id = (select id from login where username='{$usern}')");
$row1 = mysqli_fetch_assoc($propic);
$serres = "";
if ($_POST["search"] && isset($_POST['sbutton'])) {
$serres = $_POST["search"];
fileWrite("---t---", $serres);
if ($serres == "t") {
$tags = mysqli_query($conn1, "SELECT * FROM pics WHERE photoid IN (SELECT picid FROM pictags WHERE tagid in (SELECT tagid FROM tags WHERE tagname LIKE '%" . $quer . "%'))");
fileWrite("---t---", "inside");
} elseif ($serres == "u") {
$tags = mysqli_query($conn1, "SELECT * FROM user WHERE firstname LIKE '%" . $quer . "%' OR lastname LIKE '%" . $quer . "%'");
fileWrite("---u---", "inside");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Search Page</title>
<link rel="stylesheet" type="text/css" href="design.css">
</head>
<body>
<div class ="profile">
<imgd><img src="<?php