本文整理汇总了PHP中Debug::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::dump方法的具体用法?PHP Debug::dump怎么用?PHP Debug::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::dump方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: router
public function router($resource, $arguments)
{
// ルート情報を表示
Debug::dump($this->request->route);
// 名前付きパラメータの一覧を表示
Debug::dump($this->params());
}
示例2: debug
function debug()
{
$args = func_get_args();
foreach ($args as $index => $arg) {
Debug::dump($arg);
}
}
示例3: display_database_query
private function display_database_query($query)
{
if (Debug::is_display_database_query_enabled()) {
Debug::dump($query);
Debug::print_stacktrace(4);
}
}
示例4: dump
/**
* Debug::dump shortcut.
*/
function dump($var)
{
foreach (func_get_args() as $arg) {
Debug::dump($arg);
}
return $var;
}
示例5: connectTo
public function connectTo($host, $port, $blockConnect = false)
{
Debug::netEvent(get_class($this) . '::' . __METHOD__ . '(' . $host . ':' . $port . ') invoked.');
$connSocket = stream_socket_client("tcp://{$host}:{$port}", $errno, $errstr, 30);
//add err connect
stream_set_blocking($connSocket, 0);
if (!is_resource($connSocket)) {
Debug::netErrorEvent(get_class($this) . ': can not add errorneus socket with address \'' . $host . ':' . $port . '\'.');
return false;
}
$connId = daemon::getNextSocketId();
//@todo 增加阻塞 connect , 这样可以返回 connId 的时候 socketSession 已经建立好
if ($blockConnect) {
}
$ev = event_new();
// why not use EV_PERSIST, is because first event is acceptEvent?
if (!event_set($ev, $connSocket, EV_WRITE, array($this, 'onConnectedEvent'), array($connId))) {
Debug::netErrorEvent(get_class($this) . '::' . __METHOD__ . ': can not set onAcceptEvent() on binded socket: ' . Debug::dump($connSocket));
return false;
}
event_base_set($ev, daemon::$eventBase);
event_add($ev, 1 * 1000 * 1000);
$this->checkConnSocketPool[$connId] = $connSocket;
$this->checkConnEvPool[$connId] = $ev;
return $connId;
}
示例6: inspect
public static function inspect($obj, $die = true)
{
\Debug::dump($obj);
if ($die) {
die;
}
}
示例7: dump
function dump()
{
$args = (array) func_get_args();
foreach ($args as $arg) {
Debug::dump($arg);
}
}
示例8: action_index
public function action_index()
{
// Statusモデルから結果を取得する
$results = Model_Status::find_body_by_username('foo');
// $resultsをダンプして確認する
Debug::dump($results);
}
示例9: ReadAndParse
/**
*
* Reads a file and parse the vars, then returns it as a string:
* @param string $file File to parse
* @param string $post Post object
* @return string String with the file already parsed
*/
public static function ReadAndParse($file, $post = "")
{
if (!file_exists($file)) {
Debug::error("File '{$file}' not found.");
}
Debug::say("Parsing and including '{$file}'");
$string = file_get_contents($file, 1024);
# Date is the first:
while (preg_match("/\\\$\\{(GMDATE)\\}/", $string, $aRegs)) {
$string = str_replace($aRegs[0], gmdate("r"), $string);
}
while (preg_match("/\\\$\\{(DATE)\\}/", $string, $aRegs)) {
$string = str_replace($aRegs[0], date(), $string);
}
# Parsing with regular expressions:
# CONSTANTS ${CONSTANT}:
while (preg_match("/\\\$\\{([A-Z]*)\\}/", $string, $aRegs)) {
Debug::dump($aRegs);
Debug::say(" Replace {$aRegs['0']} by " . constant($aRegs[1]) . "...");
Debug::say(" Constant: " . print_r($aRegs, true));
$string = str_replace($aRegs[0], constant($aRegs[1]), $string);
}
# Vars from post ${post:key}:
if (!empty($post) and is_array($post)) {
while (preg_match("/\\\$\\{post\\:([a-z_]*)\\}/", $string, $aRegs)) {
Debug::dump($aRegs);
Debug::say(" Replace {$aRegs['0']} by post['" . $aRegs[1] . "']...");
$string = str_replace($aRegs[0], $post[$aRegs[1]], $string);
}
}
return $string;
}
示例10: edit
public function edit($url)
{
$this->load->model('admin_model', 'edit');
$data->row = $this->edit->edit($url);
Debug::dump($data->row);
exit;
$this->template->title('Edit:' . $url)->build('admin/edit', $data);
}
示例11: process
function process()
{
Debug::dump(self::config());
$layout = Responce::layout('index', 'TestBaseLayout');
$layout->title("hello, world!");
$layout->addCss('main.css');
// Debug::dump($layout);
Responce::send();
}
示例12: test_debug_dump_normally
public function test_debug_dump_normally()
{
$expected = ' <script type="text/javascript">function fuel_debug_toggle(a){if(document.getElementById){if(document.getElementById(a).style.display=="none"){document.getElementById(a).style.display="block"}else{document.getElementById(a).style.display="none"}}else{if(document.layers){if(document.id.display=="none"){document.id.display="block"}else{document.id.display="none"}}else{if(document.all.id.style.display=="none"){document.all.id.style.display="block"}else{document.all.id.style.display="none"}}}};</script><div class="fuelphp-dump" style="font-size: 13px;background: #EEE !important; border:1px solid #666; color: #000 !important; padding:10px;"><h1 style="border-bottom: 1px solid #CCC; padding: 0 0 5px 0; margin: 0 0 5px 0; font: bold 120% sans-serif;">COREPATH/tests/debug.php @ line: 41</h1><pre style="overflow:auto;font-size:100%;"><strong>Variable #1:</strong>' . "\n" . '<i></i> <strong></strong> (Integer): 1' . "\n\n\n" . '<strong>Variable #2:</strong>' . "\n" . '<i></i> <strong></strong> (Integer): 2' . "\n\n\n" . '<strong>Variable #3:</strong>' . "\n" . '<i></i> <strong></strong> (Integer): 3' . "\n\n\n" . '</pre></div>';
ob_start();
\Debug::dump(1, 2, 3);
$output = ob_get_contents();
ob_end_clean();
$this->assertEquals($expected, $output);
}
示例13: get_stocks
public function get_stocks()
{
# Where we'll get our data
$url = "http://ichart.finance.yahoo.com/table.csv?s=MSFT&d=11&e=15&f=2012&g=d&a=2&b=13&c=1986&ignore=.csv";
# use cURL to ping the above URL
$results = Utils::curl($url);
# Convery the huge CSV string to a PHP array (http://stackoverflow.com/questions/7502370/converting-csv-to-array)
$results = array_map("str_getcsv", preg_split('/\\r*\\n+|\\r+/', $results));
# Debug the results
echo Debug::dump($results, "");
}
示例14: onReady
/**
* Called when the worker is ready to go.
* @return void
*/
public function onReady()
{
$this->redis = \PHPDaemon\Clients\Redis\Pool::getInstance();
/*$this->redis->eval("return {'a','b','c', {'d','e','f', {'g','h','i'}} }",0, function($redis) {
Daemon::log(Debug::dump($redis->result));
});*/
$this->redis->subscribe('te3st', function ($redis) {
Daemon::log(Debug::dump($redis->result));
});
$this->redis->psubscribe('test*', function ($redis) {
Daemon::log(Debug::dump($redis->result));
});
}
示例15: exampleForm
private function exampleForm()
{
$countries = array('Select your country', 'Europe' => array('CZ' => 'Czech Republic', 'FR' => 'France', 'DE' => 'Germany', 'GR' => 'Greece', 'HU' => 'Hungary', 'IE' => 'Ireland', 'IT' => 'Italy', 'NL' => 'Netherlands', 'PL' => 'Poland', 'SK' => 'Slovakia', 'ES' => 'Spain', 'CH' => 'Switzerland', 'UA' => 'Ukraine', 'GB' => 'United Kingdom'), 'AU' => 'Australia', 'CA' => 'Canada', 'EG' => 'Egypt', 'JP' => 'Japan', 'US' => 'United States', '?' => 'other');
$sex = array('m' => 'male', 'f' => 'female');
// Step 1: Define form with validation rules
$form = new Form();
// group Personal data
$form->addGroup('Personal data')->setOption('description', 'We value your privacy and we ensure that the information you give to us will not be shared to other entities.');
$form->addText('name', 'Your name:', 35)->addRule(Form::FILLED, 'Enter your name');
$form->addText('age', 'Your age:', 5)->addRule(Form::FILLED, 'Enter your age')->addRule(Form::INTEGER, 'Age must be numeric value')->addRule(Form::RANGE, 'Age must be in range from %.2f to %.2f', array(9.9, 100));
$form->addRadioList('gender', 'Your gender:', $sex);
$form->addText('email', 'E-mail:', 35)->setEmptyValue('@')->addCondition(Form::FILLED)->addRule(Form::EMAIL, 'Incorrect E-mail Address');
// ... then check email
// group Shipping address
$form->addGroup('Shipping address')->setOption('embedNext', TRUE);
$form->addCheckbox('send', 'Ship to address')->addCondition(Form::EQUAL, TRUE)->toggle('sendBox');
// toggle div #sendBox
// subgroup
$form->addGroup()->setOption('container', Html::el('div')->id('sendBox'));
$form->addText('street', 'Street:', 35);
$form->addText('city', 'City:', 35)->addConditionOn($form['send'], Form::EQUAL, TRUE)->addRule(Form::FILLED, 'Enter your shipping address');
$form->addSelect('country', 'Country:', $countries)->skipFirst()->addConditionOn($form['send'], Form::EQUAL, TRUE)->addRule(Form::FILLED, 'Select your country');
// group Your account
$form->addGroup('Your account');
$form->addPassword('password', 'Choose password:', 20)->addRule(Form::FILLED, '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:', 20)->addConditionOn($form['password'], Form::VALID)->addRule(Form::FILLED, 'Reenter your password')->addRule(Form::EQUAL, 'Passwords do not match', $form['password']);
$form->addFile('avatar', 'Picture:')->addCondition(Form::FILLED)->addRule(Form::MIME_TYPE, 'Uploaded file is not image', 'image/*');
$form->addHidden('userid');
$form->addTextArea('note', 'Comment:', 30, 5);
// group for buttons
$form->addGroup();
$form->addSubmit('submit1', 'Send');
// 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>';
$values = $form->getValues();
Debug::dump($values);
// this is the end, my friend :-)
if (empty($disableExit)) {
exit;
}
}
} else {
// not submitted, define default values
$defaults = array('name' => 'John Doe', 'userid' => 231, 'country' => 'CZ');
$form->setDefaults($defaults);
}
return $form;
}