本文整理汇总了PHP中mb_sprintf函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_sprintf函数的具体用法?PHP mb_sprintf怎么用?PHP mb_sprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_sprintf函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: echo
// add column "has_html" to table "files"
echo ('CommSy database, add table: log_error.'."\n");
$success = true;
$query = "CREATE TABLE `log_error` (
`id` int(11) NOT NULL auto_increment,
`datetime` datetime NOT NULL,
`number` int(11) NOT NULL,
`type` varchar(255) NOT NULL,
`message` text NOT NULL,
`file` varchar(255) NOT NULL,
`line` int(11) NOT NULL,
`context` int(11) NOT NULL,
`module` varchar(255) NOT NULL,
`function` varchar(255) NOT NULL,
`user` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;";
$success = select($query);
if ($success) {
echo('[ <font color="#00ff00">done</font> ]<br/>'."\n");
} else {
echo('[ <font color="#ff0000">failed</font> ]<br/>'."\n");
}
// end of execution time
$time_end = getmicrotime();
$time = round($time_end - $time_start,3);
echo "<br/>Execution time: ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60))."\n";
?>
示例2: echo
echo('</h3>'."\n");
echo '<script type="text/javascript">window.scrollTo(1,10000000);</script>'."\n";
flush();
include_once($script);
echo '<script type="text/javascript">window.scrollTo(1,10000000);</script>'."\n";
flush();
if ($success == FALSE) {
echo "<font color='#ff0000'><b> [failed]</b></font>"."\n";
break;
} else {
echo "<font color='#00ff00'><b> [done]</b></font>"."\n";
}
echo('<br>');
echo '<script type="text/javascript">window.scrollTo(1,10000000);</script>'."\n";
flush();
// um mysql eine verschnaufpause zwischen jedem script zu gönnen
sleep(5);
}
// end of execution time
$time_end = getmicrotime();
$time = round($time_end - $time_start_all,3);
echo "<br/><br/><b>".count($scripts)." scripts processed in ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60))." hours</b><br><br><br>\n";
echo '<script type="text/javascript">window.scrollTo(1,10000000);</script>';
echo('</body>'."\n");
echo('</html>'."\n");
flush();
?>
示例3: getProcessedTimeInHTML
function getProcessedTimeInHTML ($time_start) {
$time_end = getmicrotime();
$time = round($time_end - $time_start,3);
$retour = LINEBREAK."Execution time: ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60)).LINEBREAK;
return $retour;
}
示例4: _performQuery
//.........这里部分代码省略.........
$query .= ' OR (user_limit2.first_item_id = "' . encode(AS_DB, $this->_user_limit) . '" OR user_limit2.second_item_id = "' . encode(AS_DB, $this->_user_limit) . '"))';
}
}
if (isset($this->_assignment_limit) and isset($this->_related_user_limit)) {
$query .= ' AND ( (related_user_limit1.first_item_id IN (' . implode(", ", $this->_related_user_limit) . ') OR related_user_limit1.second_item_id IN (' . implode(", ", $this->_related_user_limit) . ') )';
$query .= ' OR (related_user_limit2.first_item_id IN (' . implode(", ", $this->_related_user_limit) . ') OR related_user_limit2.second_item_id IN (' . implode(", ", $this->_related_user_limit) . ') ))';
}
// dates restricted by groups, second part
if (isset($this->_group_limit) and $this->_group_limit == -1) {
$query .= ' AND l31.first_item_id IS NULL AND l31.second_item_id IS NULL';
}
if (isset($this->_tag_limit)) {
$tag_id_array = $this->_getTagIDArrayByTagIDArray($this->_tag_limit);
$id_string = implode(', ', $tag_id_array);
if (isset($tag_id_array[0]) and $tag_id_array[0] == -1) {
$query .= ' AND (l41.first_item_id IS NULL AND l41.second_item_id IS NULL)';
$query .= ' AND (l42.first_item_id IS NULL AND l42.second_item_id IS NULL)';
} else {
$query .= ' AND ( (l41.first_item_id IN (' . encode(AS_DB, $id_string) . ') OR l41.second_item_id IN (' . encode(AS_DB, $id_string) . ') )';
$query .= ' OR (l42.first_item_id IN (' . encode(AS_DB, $id_string) . ') OR l42.second_item_id IN (' . encode(AS_DB, $id_string) . ') ))';
}
}
if (isset($this->_buzzword_limit)) {
if ($this->_buzzword_limit == -1) {
$query .= ' AND (l6.to_item_id IS NULL OR l6.deletion_date IS NOT NULL)';
} else {
$query .= ' AND buzzwords.item_id="' . encode(AS_DB, $this->_buzzword_limit) . '"';
}
}
if (isset($this->_day_limit)) {
$query .= ' AND DAYOFMONTH(' . $this->addDatabasePrefix('dates') . '.start_day) = "' . encode(AS_DB, $this->_day_limit) . '"';
}
if (isset($this->_month_limit) and isset($this->_year_limit)) {
$string_start_day = $this->_year_limit . '-' . mb_sprintf("%02d", $this->_month_limit) . '-' . '01';
$string_end_day = $this->_year_limit . '-' . mb_sprintf("%02d", $this->_month_limit) . '-' . daysInMonth($this->_month_limit, $this->_year_limit);
$query .= ' AND ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . ')';
} elseif (isset($this->_month_limit2) and isset($this->_year_limit)) {
$string_start_day = $this->_year_limit . '-' . mb_sprintf("%02d", $this->_month_limit2) . '-' . '01';
$string_end_day = $this->_year_limit . '-' . mb_sprintf("%02d", $this->_month_limit2) . '-' . daysInMonth($this->_month_limit2, $this->_year_limit);
$query .= ' AND ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . '';
if ($this->_month_limit2 == 1) {
$year = $this->_year_limit - 1;
$string_start_day = $year . '-' . mb_sprintf("%02d", 12) . '-' . '01';
$string_end_day = $year . '-' . mb_sprintf("%02d", 12) . '-' . daysInMonth(12, $year);
$query .= ' OR ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . ')';
$string_start_day = $this->_year_limit . '-' . mb_sprintf("%02d", 2) . '-' . '01';
$string_end_day = $this->_year_limit . '-' . mb_sprintf("%02d", 2) . '-' . daysInMonth(2, $this->_year_limit);
$query .= ' OR ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . ')';
} elseif ($this->_month_limit2 == 12) {
$year = $this->_year_limit + 1;
$string_start_day = $year . '-' . mb_sprintf("%02d", 1) . '-' . '01';
$string_end_day = $year . '-' . mb_sprintf("%02d", 1) . '-' . daysInMonth(1, $year);
$query .= ' OR ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . ')';
$string_start_day = $this->_year_limit . '-' . mb_sprintf("%02d", 11) . '-' . '01';
$string_end_day = $this->_year_limit . '-' . mb_sprintf("%02d", 11) . '-' . daysInMonth(11, $this->_year_limit);
$query .= ' OR ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . ')';
} else {
$month = $this->_month_limit2 - 1;
$string_start_day = $this->_year_limit . '-' . mb_sprintf("%02d", $month) . '-' . '01';
$string_end_day = $this->_year_limit . '-' . mb_sprintf("%02d", $month) . '-' . daysInMonth($this->_month_limit2, $this->_year_limit);
$query .= ' OR ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . ')';
$month = $this->_month_limit2 + 1;
$string_start_day = $this->_year_limit . '-' . mb_sprintf("%02d", $month) . '-' . '01';
$string_end_day = $this->_year_limit . '-' . mb_sprintf("%02d", $month) . '-' . daysInMonth($month, $this->_year_limit);
$query .= ' OR ( ' . ' (' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_start_day) . '" AND "' . encode(AS_DB, $string_end_day) . '" <= ' . $this->addDatabasePrefix('dates') . '.end_day AND (' . $this->addDatabasePrefix('dates') . '.end_day IS NOT NULL OR ' . $this->addDatabasePrefix('dates') . '.end_day !=""))' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.start_day AND ' . $this->addDatabasePrefix('dates') . '.start_day <="' . encode(AS_DB, $string_end_day) . '")' . ' OR ("' . encode(AS_DB, $string_start_day) . '"<= ' . $this->addDatabasePrefix('dates') . '.end_day AND ' . $this->addDatabasePrefix('dates') . '.end_day <="' . encode(AS_DB, $string_end_day) . '")' . ')';
}
示例5: echo
// add column "has_html" to table "files"
echo ('links add x and y.'.LINEBREAK);
$success = true;
$query = "SHOW COLUMNS FROM links";
$result = select($query);
$column_array = array();
while ($row = mysql_fetch_assoc($result) ) {
$column_array[] = $row['Field'];
}
if ( in_array('x',$column_array) ) {
echo('nothing to do for x');
} else {
$query = "ALTER TABLE links ADD x INT NULL;";
$result = select($query);
echo('x done');
}
echo(LINEBREAK);
if ( in_array('y',$column_array) ) {
echo('nothing to do for y');
} else {
$query = "ALTER TABLE links ADD y INT NULL;";
$result = select($query);
echo('y done');
}
// end of execution time
$time_end = getmicrotime();
$time = round($time_end - $time_start,3);
echo LINEBREAK."Execution time: ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60)).LINEBREAK;
?>
示例6: echo
echo('Kein MessageTag passt zu den Einträgen der Whitelist.');
}
// show used
} elseif ($mode == 'show_used') {
showUsedTags();
// delete
} elseif ($mode == 'delete') {
if (isset($_POST['really_delete']) and $_POST['really_delete']) {
echo('</br>');
echo('Anzahl gelöschter MessageTags: '.count($_POST['orphans']).'</br>');
echo('Gelöschte MessageTags:</br>');
foreach ($_POST['orphans'] as $TagID) {
echo($TagID.'</br>');
}
} else {
echo('</br>');
echo('Keine Tags gelöscht, da die Sicherheitscheckbox nicht angeklickt wurde.');
}
}
echo('</form>');
$time_end = getmicrotime();
$time = round($time_end - $time_start,3);
echo('</br>');
echo("Execution time: ".mb_sprintf("%02d:%02d:%02d", (int)($time/3600), (int)(fmod($time,3600)/60), (int)fmod(fmod($time,3600), 60)));
?>
</body>
</html>
示例7: _getProcessedTimeInHTML
private function _getProcessedTimeInHTML($time_start)
{
$time_end = $this->_getMicroTime();
$time = round($time_end - $time_start, 3);
$retour = BRLF . "Execution time: " . mb_sprintf("%02d:%02d:%02d", (int) ($time / 3600), (int) (fmod($time, 3600) / 60), (int) fmod(fmod($time, 3600), 60)) . BRLF . BRLF;
return $retour;
}