本文整理汇总了PHP中Nette\Diagnostics\Debugger::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::dump方法的具体用法?PHP Debugger::dump怎么用?PHP Debugger::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Diagnostics\Debugger
的用法示例。
在下文中一共展示了Debugger::dump方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dump
/**
* Nette\Diagnostics\Debugger::dump() shortcut.
* @tracySkipLocation
*/
function dump($var)
{
foreach (func_get_args() as $arg) {
Debugger::dump($arg);
}
return $var;
}
示例2: d
/** Dump */
function d($var)
{
if (func_num_args() > 1) {
$var = func_get_args();
}
Debugger::dump($var);
return func_get_arg(0);
}
示例3: actionDoctrineExample
public function actionDoctrineExample()
{
$articles = $this->em->getDao(Article::getClassName());
$article = new Article();
$article->title = "The Fight Club";
$articles->save($article);
$article = $articles->find(1);
$this->template->article = $article->title;
Debugger::dump($article);
$this->redirect('Homepage:default');
}
示例4: renderDefault
public function renderDefault()
{
// Autorizoval uživatel naši aplikaci?
if ($this->facebookConnect->isLoggedIn() === FALSE) {
// Volitelně můžeme změnit URL, na kterou bude uživatel z Facebooku navrácen
// Přijímá buď nette zápis odkazů nebo absolutní URL
$this->facebookConnect->setRedirectUri("Homepage:default");
// Přihlásíme ho přesměrováním na Login_URL
$this->facebookConnect->login();
} else {
/* @var $user Illagrenan\Facebook\FacebookUser */
$user = $this->facebookConnect->getFacebookUser();
$this->template->user = $user;
Debugger::dump($user);
}
}
示例5: debug
/**
* Prints out debug message to standard output
*
* @param string message
* @param mixed|null optional variable to dump along with message
*/
function debug($msg, $var = null)
{
if (Debug::$productionMode == Debug::PRODUCTION) {
return;
}
if (!isset($_SERVER['HTTP_USER_AGENT'])) {
echo $msg . "\n";
for ($i = 1; $i < func_num_args(); $i++) {
Debug::dump(func_get_arg($i));
}
} else {
if (!headers_sent()) {
header('Content-type: text/html; charset=utf-8');
}
$msgEl = Html::el('div', array('class' => 'vBuilderDebugMsg'))->setText($msg);
echo $msgEl->startTag();
echo $msgEl[0];
for ($i = 1; $i < func_num_args(); $i++) {
Debug::dump(func_get_arg($i));
}
echo $msgEl->endTag();
}
}
示例6: array
$form['password']->addRule($form::MIN_LENGTH, 'The password is too short: it must be at least %d characters', 3);
$form['password2']->addConditionOn($form['password'], $form::VALID)
->addRule($form::FILLED, 'Reenter your password')
->addRule($form::EQUAL, 'Passwords do not match', $form['password']);
// Step 2: Check if form was submitted?
if ($form->isSubmitted()) {
// Step 2c: Check if form is valid
if ($form->isValid()) {
echo '<h2>Form was submitted and successfully validated</h2>';
Debugger::dump($form->values);
// this is the end, my friend :-)
exit;
}
} else {
// not submitted, define default values
$defaults = array(
'name' => 'John Doe',
'userid' => 231,
'country' => 'CZ', // Czech Republic
);
$form->setDefaults($defaults);
}
示例7: getPanel
public function getPanel()
{
$this->disabled = TRUE;
$s = '';
$h = 'htmlSpecialChars';
foreach ($this->queries as $i => $query) {
list($sql, $params, $time, $rows, $connection, $source) = $query;
$explain = NULL;
// EXPLAIN is called here to work SELECT FOUND_ROWS()
if ($this->explain && preg_match('#\\s*SELECT\\s#iA', $sql)) {
try {
$explain = $connection->queryArgs('EXPLAIN ' . $sql, $params)->fetchAll();
} catch (\PDOException $e) {
}
}
$s .= '<tr><td>' . sprintf('%0.3f', $time * 1000);
if ($explain) {
static $counter;
$counter++;
$s .= "<br /><a href='#' class='nette-toggler' rel='#nette-DbConnectionPanel-row-{$counter}'>explain ►</a>";
}
$s .= '</td><td class="nette-DbConnectionPanel-sql">' . Connection::highlightSql(Nette\Utils\Strings::truncate($sql, self::$maxLength));
if ($explain) {
$s .= "<table id='nette-DbConnectionPanel-row-{$counter}' class='nette-collapsed'><tr>";
foreach ($explain[0] as $col => $foo) {
$s .= "<th>{$h($col)}</th>";
}
$s .= "</tr>";
foreach ($explain as $row) {
$s .= "<tr>";
foreach ($row as $col) {
$s .= "<td>{$h($col)}</td>";
}
$s .= "</tr>";
}
$s .= "</table>";
}
if ($source) {
$s .= Nette\Diagnostics\Helpers::editorLink($source[0], $source[1])->class('nette-DbConnectionPanel-source');
}
$s .= '</td><td>';
foreach ($params as $param) {
$s .= Debugger::dump($param, TRUE);
}
$s .= '</td><td>' . $rows . '</td></tr>';
}
return empty($this->queries) ? '' : '<style> #nette-debug td.nette-DbConnectionPanel-sql { background: white !important }
#nette-debug .nette-DbConnectionPanel-source { color: #BBB !important }
#nette-debug nette-DbConnectionPanel tr table { margin: 8px 0; max-height: 150px; overflow:auto } </style>
<h1>Queries: ' . count($this->queries) . ($this->totalTime ? ', time: ' . sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : '') . '</h1>
<div class="nette-inner nette-DbConnectionPanel">
<table>
<tr><th>Time ms</th><th>SQL Statement</th><th>Params</th><th>Rows</th></tr>' . $s . '
</table>
</div>';
}
示例8: getPanel
function getPanel()
{
$this->disabled = TRUE;
$s = '';
foreach ($this->queries as $i => $query) {
list($sql, $params, $time, $rows, $connection, $source) = $query;
$explain = NULL;
if ($this->explain && preg_match('#\\s*\\(?\\s*SELECT\\s#iA', $sql)) {
try {
$cmd = is_string($this->explain) ? $this->explain : 'EXPLAIN';
$explain = $connection->queryArgs("{$cmd} {$sql}", $params)->fetchAll();
} catch (\PDOException $e) {
}
}
$s .= '<tr><td>' . sprintf('%0.3f', $time * 1000);
if ($explain) {
static $counter;
$counter++;
$s .= "<br /><a href='#' class='nette-toggler' rel='#nette-DbConnectionPanel-row-{$counter}'>explain ►</a>";
}
$s .= '</td><td class="nette-DbConnectionPanel-sql">' . Helpers::dumpSql(self::$maxLength ? Nette\Utils\Strings::truncate($sql, self::$maxLength) : $sql);
if ($explain) {
$s .= "<table id='nette-DbConnectionPanel-row-{$counter}' class='nette-collapsed'><tr>";
foreach ($explain[0] as $col => $foo) {
$s .= '<th>' . htmlSpecialChars($col) . '</th>';
}
$s .= "</tr>";
foreach ($explain as $row) {
$s .= "<tr>";
foreach ($row as $col) {
$s .= '<td>' . htmlSpecialChars($col) . '</td>';
}
$s .= "</tr>";
}
$s .= "</table>";
}
if ($source) {
$s .= Nette\Diagnostics\Helpers::editorLink($source[0], $source[1])->class('nette-DbConnectionPanel-source');
}
$s .= '</td><td>';
foreach ($params as $param) {
$s .= Debugger::dump($param, TRUE);
}
$s .= '</td><td>' . $rows . '</td></tr>';
}
return empty($this->queries) ? '' : '<style class="nette-debug"> #nette-debug td.nette-DbConnectionPanel-sql { background: white !important }
#nette-debug .nette-DbConnectionPanel-source { color: #BBB !important } </style>
<h1 title="' . htmlSpecialChars($connection->getDsn()) . '">Queries: ' . count($this->queries) . ($this->totalTime ? ', time: ' . sprintf('%0.3f', $this->totalTime * 1000) . ' ms' : '') . ', ' . htmlSpecialChars($this->name) . '</h1>
<div class="nette-inner nette-DbConnectionPanel">
<table>
<tr><th>Time ms</th><th>SQL Statement</th><th>Params</th><th>Rows</th></tr>' . $s . '
</table>
</div>';
}
示例9: de
/**
* Shortcut for Debugger::dump & exit()
*
* @author Jan Tvrdík
* @param mixed
* @param mixed $var, ... optional additional variable(s) to dump
* @return void
*/
function de($var)
{
foreach (func_get_args() as $var) {
Debugger::dump($var);
}
exit;
}
示例10:
getTab(){return'<span title="Nette\\Database '.htmlSpecialChars($this->name).'">'.'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAEYSURBVBgZBcHPio5hGAfg6/2+R980k6wmJgsJ5U/ZOAqbSc2GnXOwUg7BESgLUeIQ1GSjLFnMwsKGGg1qxJRmPM97/1zXFAAAAEADdlfZzr26miup2svnelq7d2aYgt3rebl585wN6+K3I1/9fJe7O/uIePP2SypJkiRJ0vMhr55FLCA3zgIAOK9uQ4MS361ZOSX+OrTvkgINSjS/HIvhjxNNFGgQsbSmabohKDNoUGLohsls6BaiQIMSs2FYmnXdUsygQYmumy3Nhi6igwalDEOJEjPKP7CA2aFNK8Bkyy3fdNCg7r9/fW3jgpVJbDmy5+PB2IYp4MXFelQ7izPrhkPHB+P5/PjhD5gCgCenx+VR/dODEwD+A3T7nqbxwf1HAAAAAElFTkSuQmCC" />'.count($this->queries).' queries'.($this->totalTime?' / '.sprintf('%0.1f',$this->totalTime*1000).'ms':'').'</span>';}function
getPanel(){$this->disabled=TRUE;$s='';$h='htmlSpecialChars';foreach($this->queries
as$i=>$query){list($sql,$params,$time,$rows,$connection,$source)=$query;$explain=NULL;if($this->explain&&preg_match('#\s*\(?\s*SELECT\s#iA',$sql)){try{$cmd=is_string($this->explain)?$this->explain:'EXPLAIN';$explain=$connection->queryArgs("$cmd $sql",$params)->fetchAll();}catch(\PDOException$e){}}$s.='<tr><td>'.sprintf('%0.3f',$time*1000);if($explain){static$counter;$counter++;$s.="<br /><a href='#' class='nette-toggler' rel='#nette-DbConnectionPanel-row-$counter'>explain ►</a>";}$s.='</td><td class="nette-DbConnectionPanel-sql">'.Helpers::dumpSql(self::$maxLength?Nette\Utils\Strings::truncate($sql,self::$maxLength):$sql);if($explain){$s.="<table id='nette-DbConnectionPanel-row-$counter' class='nette-collapsed'><tr>";foreach($explain[0]as$col=>$foo){$s.="<th>{$h($col)}</th>";}$s.="</tr>";foreach($explain
as$row){$s.="<tr>";foreach($row
as$col){$s.="<td>{$h($col)}</td>";}$s.="</tr>";}$s.="</table>";}if($source){$s.=Nette\Diagnostics\Helpers::editorLink($source[0],$source[1])->class('nette-DbConnectionPanel-source');}$s.='</td><td>';foreach($params
as$param){$s.=Debugger::dump($param,TRUE);}$s.='</td><td>'.$rows.'</td></tr>';}return
empty($this->queries)?'':'<style> #nette-debug td.nette-DbConnectionPanel-sql { background: white !important }
#nette-debug .nette-DbConnectionPanel-source { color: #BBB !important } </style>
<h1>Queries: '.count($this->queries).($this->totalTime?', time: '.sprintf('%0.3f',$this->totalTime*1000).' ms':'').'</h1>
<div class="nette-inner nette-DbConnectionPanel">
<table>
<tr><th>Time ms</th><th>SQL Statement</th><th>Params</th><th>Rows</th></tr>'.$s.'
</table>
</div>';}}}namespace Nette\Database\Drivers{use
示例11: dumpHtml
/**
* @param mixed
* @return string
*/
private function dumpHtml($var)
{
if (class_exists('Tracy\\Dumper')) {
return Tracy\Dumper::toHtml($var, [Tracy\Dumper::COLLAPSE => TRUE]);
} elseif (class_exists('Nette\\Diagnostics\\Dumper')) {
return Nette\Diagnostics\Dumper::toHtml($var, [Nette\Diagnostics\Dumper::COLLAPSE => TRUE]);
} else {
return Nette\Diagnostics\Debugger::dump($var, TRUE);
}
}
示例12: function
* @link http://www.radekdostal.cz
*/
use Nette\Diagnostics\Debugger;
use Nette\Forms\Form;
require '../vendor/autoload.php';
Debugger::$strictMode = TRUE;
Debugger::enable();
Form::extensionMethod('addDateTimePicker', function (Form $_this, $name, $label, $cols = NULL, $maxLength = NULL) {
return $_this[$name] = new RadekDostal\NetteComponents\DateTimePicker\DateTimePicker($label, $cols, $maxLength);
});
$form = new Form();
$form->addDateTimePicker('datetime', 'Date and time:', 16, 16)->setRequired();
$form->addSubmit('submit', 'Send');
if ($form->isSuccess()) {
echo '<h2>Form was submitted and successfully validated</h2>';
Debugger::dump($form->getValues());
exit;
}
/*else
{
$form->setDefaults(array(
'datetime' => date('Y-m-d H:i')
));
}*/
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="author" content="Radek Dostál">
<title>RadekDostal\NetteComponents\DateTimePicker\DateTimePicker example</title>
示例13: d
function d()
{
if (Debug::$productionMode) {
return;
}
foreach (func_get_args() as $m) {
if (!Debug::$consoleMode && ($m instanceof \DibiResult || $m instanceof \vBuilder\Orm\Fluent)) {
if ($m instanceof \DibiResult) {
dt($m->fetchAll());
} else {
$m->test();
$data = array();
foreach ($m->fetchAll() as $entity) {
$data[] = $entity->data->getAllData();
}
dt($data);
}
} else {
Nette\Diagnostics\Debugger::dump($m);
}
}
}
示例14: datePickerFormSubmitted
/**
* Submit handler for DatePickerForm.
*
* @author Jan Tvrdík
* @param Form
* @return void
*/
public function datePickerFormSubmitted(Form $form)
{
$this->template->data = Debugger::dump($form->values, TRUE);
}
示例15:
->setType('email')
->setAttribute('autocomplete', 'off')
->setAttribute('placeholder', 'Optional, but Recommended')
->addCondition($form::FILLED) // conditional rule: if is email filled, ...
->addRule($form::EMAIL, 'Incorrect email address'); // ... then check email
$form->addSubmit('submit', 'Send');
// Step 2: Check if form was submitted?
if ($form->isSubmitted() && $form->isValid()) {
echo '<h2>Form was submitted and successfully validated</h2>';
$values = $form->values;
Debugger::dump($values);
// this is the end, my friend :-)
exit;
}
// Step 3: Render form
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Nette\Forms and HTML5 | Nette Framework</title>