本文整理匯總了PHP中vprintf函數的典型用法代碼示例。如果您正苦於以下問題:PHP vprintf函數的具體用法?PHP vprintf怎麽用?PHP vprintf使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了vprintf函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: listUsers
public static function listUsers()
{
/** @var PDO $db */
$db = self::$db;
$all = User::getListUsers();
?>
<table>
<tr>
<th>#</th>
<th>Username</th>
<th>Firstname</th>
<th>Lastname</th>
<th colspan="2">Edit</th>
</tr>
<?php
foreach ($all as $user) {
vprintf('
<tr>
<td>%1$d</td>
<td>%2$d</td>
<td>%3$s</td>
<td>%4$s</td>
<td><a href="?delete=%1$d">X</a></td>
<td><a href="?edit=%1$d">Edit</a></td>
</tr>', array($user->id, $user->username, $user->firstname, $user->lastname));
}
echo '</table>';
}
示例2: println
function println()
{
global $indent;
$args = func_get_args();
$str = array_shift($args);
vprintf(str_repeat(' ', $indent) . $str . "\n", $args);
}
示例3: execute
/**
* @see Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$selector = $input->getArgument('selector');
if (!$selector) {
$containers = $this->application->getController()->getContainers();
} else {
$containers = $this->application->getController()->selectContainers($selector);
}
$l = Formatter::calculateNamelength($containers) + 1;
$FORMAT = "%{$l}s %s\n";
printf($FORMAT, 'Name', 'Tags');
array_walk($containers, function (&$container, $key) use($FORMAT) {
$tags = $container->getTags();
if (empty($tags)) {
vprintf($FORMAT, array($container->getName(), '<none>'));
}
foreach ($tags as $key => $tag) {
if ($key === 0) {
vprintf($FORMAT, array($container->getName(), $tag));
} else {
vprintf($FORMAT, array('', $tag));
}
}
});
}
示例4: debug
/**
* @param string $format format string for the given arguments. Passed as is
* to <code>vprintf</code>.
* @param array $args array of arguments to pass to vsprinf.
* @param int $debug_level debug level at which to print this statement
* @return boolean true
*/
static function debug($format, $args, $debug_level = self::DEBUG1)
{
if (self::is_debug($debug_level)) {
vprintf($format . "\n", $args);
}
return true;
}
示例5: writefln
function writefln($fmt)
{
$args = func_get_args();
array_shift($args);
vprintf($fmt, $args);
echo PHP_EOL;
}
示例6: printMessage
/**
* Print a formatted message
*
* @param string $message sprintf-formatted message
*
* @return void
*/
public static function printMessage($message)
{
$args = func_get_args();
/* remove first argument, which is $message */
array_splice($args, 0, 1);
vprintf($message, $args);
}
示例7: __
function __($key)
{
global $_LANG_POT;
if (!isset($_LANG_POT[$key])) {
$_LANG_POT[$key] = $key;
}
vprintf($_LANG_POT[$key], array_slice(func_get_args(), 1));
}
示例8: log
/**
* Log Handling
*/
public function log($type, $args)
{
$args[0] .= ' in ' . get_class($this);
if (is_a($this->log, 'NyaaLog')) {
return call_user_func_array(array($this->log, $type), $args);
}
vprintf("[{$type}] %s<br />\n", vsprintf($args[0], array_slice($args, 1)));
}
示例9: show
function show()
{
$choices = array();
foreach ($this->choices as $c) {
$choices[] = str_replace("\n", '|||', str_replace("'", '~~~', $c));
}
vprintf("SFQuiz = {id: '%s', question: '%s', choices: '%s', answer: %d}", array($this->id, str_replace("\n", '|||', str_replace("'", '~~~', $this->question)), implode(",", $choices), $this->answer));
}
示例10: dprintf
function dprintf()
{
if (($_SERVER["REMOTE_ADDR"] == "94.169.97.53" || $_SERVER["REMOTE_ADDR"] == "80.45.72.211") && SHOW_DEBUGGING) {
$argv = func_get_args();
$format = array_shift($argv);
printf('<p class="debug">[%4.3f] ', curScriptTime());
vprintf($format, $argv);
printf('</p>');
}
}
示例11: __p
/**
* Global translate function # 3
* This function performs print OR vprintf on a translated String
*
* @param string $key
* @param array|null $args
*/
function __p(string $key, array $args = null)
{
$translated = Translator::getInstance()->translate($key);
if (is_string($translated)) {
if (is_array($args)) {
vprintf($translated, $args);
} else {
print $translated;
}
}
}
示例12: teaberry_admin_header_image
/**
* output markup to be displayed in the admin panel
*/
function teaberry_admin_header_image()
{
?>
<div id="headimg">
<?php
$image = get_header_image();
if (!empty($image)) {
$header = array('image' => esc_url($image), 'class' => 'header-image', 'width' => get_custom_header()->width, 'height' => get_custom_header()->height);
vprintf('<img src="%s" class="%s" width="%s" height="%s" alt="" />', $header);
}
?>
</div>
<?php
}
示例13: debug
/**
* Outputs some debug information about the current response.
*
* @param string $realOutput Whether to display the actual content of the response when an error occurred
* or the exception message and the stack trace to ease debugging
*/
public function debug($realOutput = false)
{
print $this->tester->error('Response debug');
if (!$realOutput && null !== sfException::getLastException())
{
// print the exception and the stack trace instead of the "normal" output
$this->tester->comment('WARNING');
$this->tester->comment('An error occurred when processing this request.');
$this->tester->comment('The real response content has been replaced with the exception message to ease debugging.');
}
printf("HTTP/1.X %s\n", $this->response->getStatusCode());
foreach ($this->response->getHttpHeaders() as $name => $value)
{
printf("%s: %s\n", $name, $value);
}
foreach ($this->response->getCookies() as $cookie)
{
vprintf("Set-Cookie: %s=%s; %spath=%s%s%s%s\n", array(
$cookie['name'],
$cookie['value'],
null === $cookie['expire'] ? '' : sprintf('expires=%s; ', date('D d-M-Y H:i:s T', $cookie['expire'])),
$cookie['path'],
$cookie['domain'] ? sprintf('; domain=%s', $cookie['domain']) : '',
$cookie['secure'] ? '; secure' : '',
$cookie['httpOnly'] ? '; HttpOnly' : '',
));
}
echo "\n";
if (!$realOutput && null !== $exception = sfException::getLastException())
{
echo $exception;
}
else
{
echo $this->response->getContent();
}
echo "\n";
}
示例14: init
function init()
{
global $FANNIE_URL;
$this->add_script($FANNIE_URL . 'src/javascript/jquery.js');
$this->add_script($FANNIE_URL . 'src/javascript/jquery-ui.js');
$this->add_css_file($FANNIE_URL . "src/javascript/jquery-ui.css");
ob_start();
vprintf('
<a href="%s">Home</a>
<a href="%s&mode=view">View</a>
<a href="%s&mode=receive">Add</a>
<a href="%s&mode=sale">Use</a>
<a href="%s&mode=adjust">Adjust</a>
<a href="%s&mode=import">Import</a>
', array_fill(0, 6, 'Brewventory.php'));
return ob_get_clean();
}
示例15: printUnknown
function printUnknown($file)
{
fseek($file, 0x6a616);
$output = [];
$totals = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
for ($i = 0; $i < 32; $i++) {
for ($j = 1; $j < 100; $j++) {
$output[$i][$j] = ord(fgetc($file));
}
}
echo 'LV | 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ' . PHP_EOL;
echo '------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
for ($i = 1; $i < 100; $i++) {
printf('%02d | ', $i);
foreach ($output as $k => $levelarray) {
$totals[$k] += $levelarray[$i];
$totals[$k] = min($totals[$k], 999);
printf('%02d ', $levelarray[$i]);
}
echo PHP_EOL;
}
echo '------------------------------------------------------------------------------------------------------------------------------------' . PHP_EOL;
vprintf('TOT| %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d %03d', $totals);
}