本文整理汇总了PHP中vprintf函数的典型用法代码示例。如果您正苦于以下问题:PHP vprintf函数的具体用法?PHP vprintf怎么用?PHP vprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vprintf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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>';
}
开发者ID:skoning,项目名称:ums,代码行数:28,代码来源:user.php
示例2: println
function println()
{
global $indent;
$args = func_get_args();
$str = array_shift($args);
vprintf(str_repeat(' ', $indent) . $str . "\n", $args);
}
开发者ID:ni-c,项目名称:pel,代码行数:7,代码来源:make-image-test.php
示例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));
}
}
});
}
开发者ID:KernelMadness,项目名称:ContainerKit,代码行数:28,代码来源:TagListCommand.php
示例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;
}
开发者ID:wikimedia,项目名称:avro,代码行数:14,代码来源:debug.php
示例5: writefln
function writefln($fmt)
{
$args = func_get_args();
array_shift($args);
vprintf($fmt, $args);
echo PHP_EOL;
}
开发者ID:rsky,项目名称:php-mecab,代码行数:7,代码来源:common.inc.php
示例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);
}
开发者ID:tedwp,项目名称:porpoise,代码行数:14,代码来源:gui.class.php
示例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));
}
开发者ID:1upon0,项目名称:ui,代码行数:8,代码来源:lib_lang.php
示例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)));
}
开发者ID:kurari,项目名称:Nyaa-System,代码行数:11,代码来源:object.class.php
示例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));
}
开发者ID:n2i,项目名称:xvnkb,代码行数:8,代码来源:quiz.php
示例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>');
}
}
开发者ID:SpeedProg,项目名称:wormhol.es,代码行数:10,代码来源:funcs.php
示例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;
}
}
}
开发者ID:comelyio,项目名称:comely,代码行数:18,代码来源:globalTranslateFunctions.php
示例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
}
开发者ID:honeymustard,项目名称:teaberry,代码行数:21,代码来源:header.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";
}
开发者ID:nresni,项目名称:sfBehatPlugin,代码行数:49,代码来源:sfBehatTesterResponse.class.php
示例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();
}
开发者ID:phpsmith,项目名称:IS4C,代码行数:23,代码来源:Brewventory.php
示例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);
}
开发者ID:Herringway,项目名称:Misc-PHP-Trash,代码行数:24,代码来源:dwm2dump.php
示例16: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
$title = apply_filters('widget_title', $instance['title']);
if ($instance['width'] == 0) {
$width = null;
} else {
$width = 'width="' . $instance['width'] . '"';
}
if ($instance['height'] == 0) {
$height = null;
} else {
$height = 'height="' . $instance['height'] . '"';
}
echo $args['before_widget'];
if (!empty($title)) {
echo str_replace('<h3>', '<h3 class="pinterest">', $args['before_title']) . $title . $args['after_title'];
}
// Download RSS
$things = $this->download_rss($instance['username'], $instance['number'], $instance['cache-time']);
if (is_null($things)) {
printf('Unable to load Pinterest pins for %s', $instance['username']);
} else {
echo '<ul class="latest-works pinterest">';
foreach ($things as $thing) {
array_push($thing, $width);
array_push($thing, $height);
vprintf('<li><a href="%s" rel="external nofollow"><img src="%s" alt="%s" %s %s /></a></li>', $thing);
// may we can use style="height:auto; width:auto; max-width:%dpx; max-height:%dpx;" ?
}
echo '</ul>';
if ($instance['follow-text'] != '') {
printf('<a class="view-all" href="http://pinterest.com/%s/" rel="">%s</a>', $instance['username'], $instance['follow-text']);
}
}
echo $args['after_widget'];
}
开发者ID:javalidigital,项目名称:tecnigrav,代码行数:44,代码来源:motive-pinterest-widget.php
示例17: execute
/**
* @see Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($selector = $input->getArgument('selector')) {
$containers = $this->application->getController()->selectContainers($selector);
} else {
$containers = $this->application->getController()->getContainers();
}
$namelength = Formatter::calculateNamelength($containers) + 1;
$FORMAT = "%2s %{$namelength}s %6s %8s %12s %12s %12s %18s %10s %10s\n";
printf($FORMAT, ' ', 'Name', 'Tasks', 'Rss', 'User time', 'System time', 'Uptime', 'IP', 'Upload', 'Download');
foreach ($containers as $container) {
$r = array('state' => '', 'name' => '', 'tasks' => 'n/a', 'rss' => 'n/a', 'usertime' => 'n/a', 'systemtime' => 'n/a', 'uptime' => 'n/a', 'ip' => 'n/a', 'upload' => 'n/a', 'download' => 'n/a');
$r['name'] = $container->getName();
$state = $container->getState();
if ($state == 'RUNNING') {
$r['state'] = \Console_Color::convert(' %g>>%n');
} else {
if ($state == 'STOPPED') {
$r['state'] = \Console_Color::convert(' %b--%n');
}
}
if ($state == 'RUNNING') {
$r['tasks'] = count($container->getTasks());
$r['rss'] = Formatter::formatBytes($container->getRss());
$r['uptime'] = Formatter::formatTime($container->getUptime());
$times = $container->getCpuTimes();
$r['systemtime'] = Formatter::formatTime($times['system']);
$r['usertime'] = Formatter::formatTime($times['user']);
$r['ip'] = $container->getIp();
$traffic = $container->getTraffic();
$r['upload'] = Formatter::formatBytes($traffic['upload']);
$r['download'] = Formatter::formatBytes($traffic['download']);
}
vprintf($FORMAT, $r);
}
}
开发者ID:KernelMadness,项目名称:ContainerKit,代码行数:39,代码来源:StatCommand.php
示例18: execute
/**
* @see Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($selector = $input->getArgument('selector')) {
$containers = $this->application->getController()->selectContainers($selector);
} else {
$containers = $this->application->getController()->getContainers();
}
$namelength = Formatter::calculateNamelength($containers) + 1;
$FORMAT = "%2s %{$namelength}s\n";
printf($FORMAT, ' ', 'Name');
foreach ($containers as $container) {
$r = array('state' => '', 'name' => '');
$r['name'] = $container->getName();
$state = $container->getState();
if ($state == 'RUNNING') {
$r['state'] = \Console_Color::convert(' %g>>%n');
} else {
if ($state == 'STOPPED') {
$r['state'] = \Console_Color::convert(' %b--%n');
}
}
vprintf($FORMAT, $r);
}
}
开发者ID:KernelMadness,项目名称:ContainerKit,代码行数:27,代码来源:ListCommand.php
示例19: array
*
* @author Gareth Stones <[email protected]>
* @copyright 5th December 2007
*/
$continue = true;
if (methodCheck(FILE) == true) {
$clean = array();
foreach ($_POST as $key => $value) {
if (in_array($key, $allow[FILE]) == false || ($clean[$key] = new SecureData($value)) == false || $clean[$key]->isValid == false) {
unset($clean);
require_once DIR_COMPONENT . FILE . '/error.php';
break 2;
}
}
$query = null;
$query = vprintf('CALL login_user ("%s", "%s")', $clean);
unset($clean);
$result = null;
try {
$result = $mysql->query($query);
unset($query);
if ($result->num_rows == 1 && ($row = $result->fetch_assoc()) == true && $row['success'] == 1) {
$continue = false;
require_once DIR_COMPONENT . FILE . '/success.php';
}
} catch (MySQLException $e) {
require_once DIR_COMPONENT . FILE . '/error.php';
}
}
if ($continue == true) {
$content->display(FILE);
开发者ID:reZo,项目名称:Tiger,代码行数:31,代码来源:login.php
示例20: printLn
function printLn($string)
{
$vars = func_get_args();
array_shift($vars);
vprintf('>>> ' . $string . PHP_EOL, $vars);
}
开发者ID:retrinko,项目名称:ini,代码行数:6,代码来源:sample.php
注:本文中的vprintf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论