当前位置: 首页>>代码示例>>PHP>>正文


PHP Dumper::dump方法代码示例

本文整理汇总了PHP中Tracy\Dumper::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP Dumper::dump方法的具体用法?PHP Dumper::dump怎么用?PHP Dumper::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tracy\Dumper的用法示例。


在下文中一共展示了Dumper::dump方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doDump

 protected function doDump($data)
 {
     if (!class_exists('\\Tracy\\Dumper')) {
         return '';
     }
     ob_start();
     Dumper::dump($data, $this->options);
     return ob_get_clean();
 }
开发者ID:YepFoundation,项目名称:tracy-twig-extensions,代码行数:9,代码来源:DumpExtension.php

示例2: getPanel

 public function getPanel()
 {
     if (empty($this->requests)) {
         return '';
     }
     $panel = '<h1>Mandrill API calls</h1>' . '<div class="tracy-inner tracy-MandrillPanel">' . '<style type="text/css">' . '#tracy-debug .tracy-panel .tracy-MandrillPanel tr:nth-child(2n) td { background: inherit; }' . '</style>' . '<table>';
     foreach ($this->requests as $index => $request) {
         $panel .= '<tr><th>' . ($index + 1) . '</th><td>';
         ob_start();
         Dumper::dump($request, [Dumper::DEPTH => 6]);
         $panel .= ob_get_clean() . '</td></tr>';
     }
     return $panel . '</table>' . '</div>';
 }
开发者ID:lookyman,项目名称:mandrill,代码行数:14,代码来源:Panel.php

示例3: getPanel

 public function getPanel()
 {
     $s = '';
     ob_start();
     echo '<div class="tracy-inner">';
     echo '<table>';
     foreach (array_filter($this->requests, function ($value) {
         return isset($value['result']);
     }) as $req) {
         /** @var QueryInterface $query */
         $query = $req['query'];
         /** @var Request $request */
         $request = $req['request'];
         /** @var ResultInterface $result */
         $result = $req['result'];
         $data = $result->getData();
         echo '<tr><td>';
         echo '<h3 style="font-weight:bold;font-size: 15px">Rows:</h3>';
         if (isset($data['grouped'])) {
             $groupInfo = [];
             foreach ($data['grouped'] as $name => $info) {
                 $groupInfo[] = $name . ' - ' . $info['matches'] . (isset($info['ngroups']) ? ' (' . $info['ngroups'] . ' groups)' : '');
             }
             echo implode(', ', $groupInfo);
         } else {
             echo $data['response']['numFound'];
         }
         echo '<h3 style="font-weight:bold;font-size: 15px">Request:</h3>';
         echo '<div>' . $request->getMethod() . ': ' . $request->getUri() . '</div>';
         echo '<h3 style="font-weight:bold;font-size: 13px">Parameters:</h3><table style="margin-top: 5px">';
         foreach ($request->getParams() as $key => $value) {
             echo '<tr><th>' . $key . '</th><td>';
             Dumper::dump($value);
             echo '</td></tr>';
         }
         echo '</table>';
         echo '<h3 style="font-weight: bold;font-size:16px">Timing: </h3>';
         $hasTiming = $result instanceof SelectResult && $result->getDebug()->getTiming();
         if ($hasTiming) {
             $debugTime = $result->getDebug()->getTiming()->getPhase('process')->getTiming('debug');
         } else {
             $debugTime = 0;
         }
         echo '<h4 style="font-weight: bold;font-size:14px">' . ($data['responseHeader']['QTime'] - $debugTime) . 'ms (without debug)</h4>';
         if ($hasTiming) {
             echo '<table>';
             /** @var TimingPhase $phase */
             foreach ($result->getDebug()->getTiming() as $name => $phase) {
                 echo '<tr>';
                 echo '<th>' . $name . "</th>";
                 echo '<td>' . $phase->getTime() . 'ms</td>';
                 echo '<td><table>';
                 foreach ($phase->getTimings() as $key => $time) {
                     echo '<tr><th>' . $key . "</t><td>" . $time . 'ms</td></tr>';
                 }
                 echo '</table></td>';
                 echo '</tr>';
             }
             echo '</table>';
         }
         if ($result instanceof SelectResult) {
             echo '<h3 style="font-weight: bold;font-size:16px">Explain:</h3>';
             Dumper::dump($result->getDebug()->getExplain(), [Dumper::DEPTH => 16]);
             if (count($result->getDebug()->getExplainOther())) {
                 Dumper::dump($result->getDebug()->getExplainOther(), [Dumper::DEPTH => 16]);
             }
         }
         echo '</td></tr>';
     }
     echo '</table>';
     echo '</div>';
     $s .= ob_get_clean();
     return empty($this->requests) ? '' : '<h1>Queries: ' . count($this->requests) . ($this->totalTime !== NULL ? ', time: ' . $this->totalTime . ' ms' : '') . '</h1>' . $s;
 }
开发者ID:librette,项目名称:solarium,代码行数:74,代码来源:Panel.php

示例4: dump

 /**
  * Dumps information about a variable in readable format.
  * @tracySkipLocation
  * @param  mixed  variable to dump
  * @param  bool   return output instead of printing it? (bypasses $productionMode)
  * @return mixed  variable itself or dump
  */
 public static function dump($var, $return = FALSE)
 {
     if ($return) {
         ob_start();
         Dumper::dump($var, [Dumper::DEPTH => self::$maxDepth, Dumper::TRUNCATE => self::$maxLen]);
         return ob_get_clean();
     } elseif (!self::$productionMode) {
         Dumper::dump($var, [Dumper::DEPTH => self::$maxDepth, Dumper::TRUNCATE => self::$maxLen, Dumper::LOCATION => self::$showLocation]);
     }
     return $var;
 }
开发者ID:janlanger,项目名称:tracy,代码行数:18,代码来源:Debugger.php

示例5:

$second = $form->addContainer('second');
$second->addText('name', 'Your name:');
$second->addText('email', 'Email:');
$second->addText('street', 'Street:');
$second->addText('city', 'City:');

// group for button
$form->addGroup();

$form->addSubmit('submit', 'Send');


if ($form->isSuccess()) {
	echo '<h2>Form was submitted and successfully validated</h2>';
	Dumper::dump($form->getValues());
	exit;
}


?>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Nette Forms containers example</title>
<link rel="stylesheet" media="screen" href="assets/style.css" />

<h1>Nette Forms containers example</h1>

<?php echo $form ?>

<footer><a href="https://doc.nette.org/en/forms">see documentation</a></footer>
开发者ID:nakoukal,项目名称:fakturace,代码行数:30,代码来源:containers.php

示例6:

$countries = ['World' => ['bu' => 'Buranda', 'qu' => 'Qumran', 'st' => 'Saint Georges Island'], '?' => 'other'];
$form->addSelect('country', 'Country:', $countries)->setPrompt('Select your country')->addConditionOn($form['send'], $form::FILLED)->setRequired('Select your country');
// group Your account
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password:')->setRequired('Choose your password')->addRule($form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
$form->addPassword('password2', 'Reenter password:')->setRequired('Reenter your password')->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
$form->addUpload('avatar', 'Picture:')->setRequired(FALSE)->addRule($form::IMAGE, 'Uploaded file is not image');
$form->addHidden('userid');
$form->addTextArea('note', 'Comment:');
// group for buttons
$form->addGroup();
$form->addSubmit('submit', 'Send');
$form->setDefaults(['name' => 'John Doe', 'userid' => 231]);
if ($form->isSuccess()) {
    echo '<h2>Form was submitted and successfully validated</h2>';
    Dumper::dump($form->getValues(), [Dumper::COLLAPSE => FALSE]);
    exit;
}
?>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Nette Forms basic example</title>
<link rel="stylesheet" media="screen" href="assets/style.css" />
<script src="https://nette.github.io/resources/js/netteForms.js"></script>

<h1>Nette Forms basic example</h1>

<?php 
echo $form;
?>
开发者ID:nette,项目名称:forms,代码行数:30,代码来源:basic-example.php

示例7: format

 /**
  * @param mixed $parameter
  * @return string
  */
 public static function format($parameter)
 {
     if ($parameter === NULL) {
         return '<span style="color: blue">NULL</span>';
     } else {
         if ($parameter instanceof ArrayAccessor) {
             ob_start();
             Dumper::dump($parameter->getArray(), [Dumper::TRUNCATE => Debugger::$maxLen, Dumper::DEPTH => Debugger::$maxDepth, Dumper::COLLAPSE => TRUE]);
             return ob_get_clean();
         } else {
             if (is_array($parameter)) {
                 ob_start();
                 Dumper::dump($parameter, [Dumper::TRUNCATE => Debugger::$maxLen, Dumper::DEPTH => Debugger::$maxDepth, Dumper::COLLAPSE => TRUE]);
                 return ob_get_clean();
             } else {
                 return (string) $parameter;
             }
         }
     }
 }
开发者ID:webchemistry,项目名称:parameters,代码行数:24,代码来源:Debug.php


注:本文中的Tracy\Dumper::dump方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。