當前位置: 首頁>>代碼示例>>PHP>>正文


PHP vprintf函數代碼示例

本文整理匯總了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>';
    }
開發者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>
         &nbsp;&nbsp;&nbsp;&nbsp;
         <a href="%s&mode=view">View</a>
         &nbsp;&nbsp;&nbsp;&nbsp;
         <a href="%s&mode=receive">Add</a>
         &nbsp;&nbsp;&nbsp;&nbsp;
         <a href="%s&mode=sale">Use</a>
         &nbsp;&nbsp;&nbsp;&nbsp;
         <a href="%s&mode=adjust">Adjust</a>
         &nbsp;&nbsp;&nbsp;&nbsp;
         <a href="%s&mode=import">Import</a>
         &nbsp;&nbsp;&nbsp;&nbsp;
         ', 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


注:本文中的vprintf函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。