本文整理汇总了PHP中FileWriter::writeLine方法的典型用法代码示例。如果您正苦于以下问题:PHP FileWriter::writeLine方法的具体用法?PHP FileWriter::writeLine怎么用?PHP FileWriter::writeLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileWriter
的用法示例。
在下文中一共展示了FileWriter::writeLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resetCrontab
public static function resetCrontab()
{
$cron_file = 'cron.txt';
$cron = new FileWriter($cron_file, 'a');
$setSessionPath = '/home1/enderrac/SpirePHP/setSessionWinner.php';
$stm = "SELECT EXTRACT(MINUTE from end_ts) as minute, " . "\tEXTRACT(HOUR from end_ts) as hour, " . "\tEXTRACT(day from end_ts) as day_of_month, " . "\tEXTRACT(MONTH from end_ts) as month, " . "\tEXTRACT(dow from end_ts) as day_of_week, " . "\tid " . "FROM SPIRE.SESSIONS ";
$result = ConnDB::query_db($stm);
$fnHash = null;
if (!$result) {
$cron->writeLine("ERROR");
$fnHash = MyUtil::fnOk(false, "SQL Error getting Session Info", null);
} else {
while ($row = pg_fetch_assoc($result)) {
$cron->writeLine($row['minute'] . " " . $row['hour'] . " " . $row['day_of_month'] . " " . $row['month'] . " " . $row['day_of_week'] . " {$setSessionPath} " . $row['id']);
}
$rmCron = shell_exec('crontab -r');
if ($rmCron != null) {
$setCron = shell_exec('crontab $cron_file');
if ($setCron != null) {
$delCronTmp = shell_exec('rm $cron_file');
if ($delCronTmp != null) {
$fnHash = MyUtil::fnOk(true, "Updated Cron and Session", null);
}
$fnHash = MyUtil::fnOk(false, "Cron Tmp File not Deleted", null);
}
$fnHash = MyUtil::fnOk(false, "Cron not set to tmp", null);
} else {
$fnHash = MyUtil::fnOk(false, "Original cron not deleted", null);
}
return $fnHash;
}
return $fnHash;
}
示例2: catch
$log->close();
} catch (Exception $e) {
// ignore
}
header('HTTP/1.0 500 Error');
die;
}
// connect to DB
try {
$db = DbConnection::getInstance();
$db->connect($website->getConfig('db_host'), $website->getConfig('db_user'), $website->getConfig('db_passwort'), $website->getConfig('db_name'));
} catch (Exception $e) {
// write to log
try {
$log = new FileWriter('dberrorlog.txt');
$log->writeLine('DB Error: ' . $e->getMessage());
$log->close();
} catch (Exception $e) {
// ignore
}
die('<h1>Sorry, our data base is currently not available</h1><p>We are working on it.</p>');
}
// register own session handler
$handler = new DbSessionManager($db, $website);
session_set_save_handler(array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc'));
// the following prevents unexpected effects when using objects as save handlers
// see http://php.net/manual/en/function.session-set-save-handler.php
register_shutdown_function('session_write_close');
session_start();
// always set time zone in order to prevent PHP warnings
try {
示例3: elseif
<input type='submit' class='btn btn-primary' accesskey='s' title='Alt + s' value='<?php
echo $i18n->getMessage('button_save');
?>
'>
<input type='reset' class='btn' value='<?php
echo $i18n->getMessage('button_reset');
?>
'>
</div>
</form>
<?php
} elseif ($show == 'save') {
if (!isset($_POST['content']) || !$_POST['content']) {
$err[] = $i18n->getMessage('imprint_validationerror_content');
}
if ($admin['r_demo']) {
$err[] = $i18n->getMessage('validationerror_no_changes_as_demo');
}
if (isset($err)) {
include 'validationerror.inc.php';
} else {
echo '<h1>' . $mainTitle . ' » ' . $i18n->getMessage('subpage_save_title') . '</h1>';
$fw = new FileWriter(IMPRINT_FILE);
$fw->writeLine(stripslashes($_POST['content']));
$fw->close();
echo createSuccessMessage($i18n->getMessage('alert_save_success'), '');
echo '<p>» <a href=\'?site=' . $site . '\'>' . $i18n->getMessage('back_label') . '</a></p>';
}
}
示例4: logAdminAction
/**
* Writes a log statement into the entity log file.
*
* @param WebSoccer $websoccer application context.
* @param string $type edit|delete
* @param string $username name of admin who executed an action.
* @param string $entity name of affacted entity.
* @param string $entityValue string value which identifies the entity item.
*/
function logAdminAction(WebSoccer $websoccer, $type, $username, $entity, $entityValue)
{
$userIp = getenv('REMOTE_ADDR');
$message = $websoccer->getFormattedDatetime($websoccer->getNowAsTimestamp()) . ';' . $username . ';' . $userIp . ';' . $type . ';' . $entity . ';' . $entityValue;
$file = BASE_FOLDER . '/generated/entitylog.php';
$fw = new FileWriter($file, FALSE);
$fw->writeLine($message);
$fw->close();
}