本文整理汇总了PHP中CVarDumper::dump方法的典型用法代码示例。如果您正苦于以下问题:PHP CVarDumper::dump方法的具体用法?PHP CVarDumper::dump怎么用?PHP CVarDumper::dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVarDumper
的用法示例。
在下文中一共展示了CVarDumper::dump方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dump
public static function dump()
{
echo '<pre>';
CVarDumper::dump(func_get_args());
echo '<pre>';
exit;
}
示例2: e
function e($msg, $exit = true, $depth = 10)
{
CVarDumper::dump($msg, $depth, true);
if ($exit) {
exit;
}
}
示例3: actionChangeState
public function actionChangeState($hotelBookerId = 0, $newState = '')
{
if ($hotelBookerId) {
/** @var HotelBookerComponent $hotelBookerComponent */
$hotelBookerComponent = new HotelBookerComponent();
$hotelBookerComponent->setHotelBookerFromId($hotelBookerId);
echo "HotelBookerId " . $hotelBookerComponent->getHotelBookerId() . PHP_EOL;
echo "Current status is " . $hotelBookerComponent->getCurrent()->swGetStatus() . PHP_EOL;
echo "Next possible status are " . $hotelBookerComponent->getCurrent()->swGetNextStatus() . PHP_EOL;
echo "Trying to change status to {$newState}" . PHP_EOL;
if ($newState) {
$res = $hotelBookerComponent->status($newState);
if (!$res) {
CVarDumper::dump($hotelBookerComponent->getCurrent()->getErrors());
CVarDumper::dump($hotelBookerComponent->getCurrent()->getAttributes());
echo PHP_EOL;
} else {
$hotelBookerComponent->getCurrent()->onlySave();
}
echo "Status is " . $hotelBookerComponent->getCurrent()->swGetStatus() . "\n";
}
} else {
$helpText = $this->getHelp();
$helpText = str_replace('command', 'ChangeState', $helpText);
echo $helpText;
}
}
示例4: dump
/**
* Displays a variable.
* This method achieves the similar functionality as var_dump and print_r
* but is more robust when handling complex objects such as Yii controllers.
* @param mixed $var variable to be dumped
*/
public static function dump()
{
$args = func_get_args();
if (php_sapi_name() == "cli") {
foreach ($args as $k => $var) {
var_dump($var);
echo "\n";
}
return;
} else {
if (empty($_SERVER['SERVER_ADDR']) || empty($_SERVER['REMOTE_ADDR']) || $_SERVER['SERVER_ADDR'] !== $_SERVER['REMOTE_ADDR']) {
return;
}
}
$backTrace = debug_backtrace();
$backTrace = array_shift($backTrace);
echo '<div style="margin: 10px;border: 1px solid red;padding: 10px; background: #fff;">';
if (is_array($backTrace) && isset($backTrace['file']) && isset($backTrace['function']) && $backTrace['function'] === __FUNCTION__) {
echo "<b>{$backTrace['file']}</b> in line <b>{$backTrace['line']}</b> <br />";
echo '<div style="border-bottom:1px solid #006699;margin: 5px 0;"></div>';
}
foreach ($args as $k => $var) {
echo CVarDumper::dump($var, 10, true), '<br />';
}
echo "</div>";
}
示例5: d
/**
* Функция для отладки, печатает переменную с подсветкой синтаксиса
* @param mixed
*/
function d()
{
foreach (func_get_args() as $arg) {
CVarDumper::dump($arg, 10, true);
echo '<hr>';
}
}
示例6: getPageResults
public function getPageResults()
{
Console::writeLine('fetching');
$this->fetch();
file_put_contents(Yii::app()->basePath . '/reports/pagehtml.html', $this->pageHtml);
CVarDumper::dump($this->response, 10, false);
die('Debug Point');
}
示例7: dump
function dump($var, $depth = 10, $highlight = true)
{
if (class_exists('CVarDumper')) {
CVarDumper::dump($var, $depth, $highlight);
} else {
var_dump($var);
}
}
示例8: getDumpForDb
private function getDumpForDb($db)
{
echo date('H:i:s Y-m-d') . ' Start backup ' . $db . PHP_EOL;
$file = $this->file . '_' . $db . '.sql';
$command = 'mysqldump -uoleg -pq1w2e3r4 ' . $db . ' > ' . $file;
$results = array();
exec($command, $results);
if (!empty($results)) {
CVarDumper::dump($results);
}
echo date('H:i:s Y-m-d') . ' End backup ' . $db . PHP_EOL;
}
示例9: actionMailTes
public function actionMailTes()
{
$message = new YiiMailMessage();
$message->setBody('tes', 'text/html');
$message->setTo('neo_gazebo@yahoo.co.id');
$message->setSubject('tes');
$message->setFrom('admin@dcourier.com');
$html2pdf = Yii::app()->ePdf->HTML2PDF();
$html2pdf->WriteHTML('<p>hehehehe</p>');
$html2pdf->Output(dirname(Yii::app()->basePath) . '/pdf/tes.pdf', EYiiPdf::OUTPUT_TO_FILE);
$message->attach(Swift_Attachment::frompath(dirname(Yii::app()->basePath) . '/pdf/tes.pdf'));
Yii::app()->mail->send($message);
CVarDumper::dump(YiiMail::log($message), 10, true);
}
示例10: dump
static function dump($var)
{
$highlighter = new CTextHighlighter();
$highlighter->language = 'PHP';
//echo $highlighter->highlight(print_r($var, true));
CVarDumper::dump($var, 10, true);
//echo print_r($var, true);
//echo '<pre>' . $output . '</pre>';
/*
echo '<pre>'; print_r($var); echo '</pre>';
echo "<br>================================</br>";
echo '<pre>'; var_dump($var); echo '</pre>';
*/
}
示例11: dump
/**
* Debug функция, использемая только для отладки
*
* @param $var
* @param int $skipCount
* @param int $depth
*/
function dump($var, $skipCount = 0, $depth = 2)
{
static $startSkipCount = 0;
static $localSkipCount = 0;
if ($startSkipCount == 0) {
$startSkipCount = $localSkipCount = $skipCount;
} else {
$localSkipCount--;
}
if ($localSkipCount == 0) {
$startSkipCount = 0;
echo '<pre>';
CVarDumper::dump($var, $depth, true);
echo '</pre>';
exit;
}
}
示例12: actionImportCustomer
public function actionImportCustomer()
{
ini_set('max_execution_time', 300);
$this->layout = '//layouts/column2';
$model = new FAreaCodesCSV();
$code_area = '';
$city = '';
$main_city_code = '';
$location = '';
if (isset($_POST['FAreaCodesCSV'])) {
$model->attributes = $_POST['FAreaCodesCSV'];
if ($model->validate()) {
$csvFile = CUploadedFile::getInstance($model, 'file');
$tempLoc = $csvFile->getTempName();
$rawdatas = file($tempLoc);
try {
$connection = Yii::app()->db;
$transaction = $connection->beginTransaction();
$sql = "INSERT INTO area_code (code, city, main_city_code, location) VALUES(:code, :city, :main_city_code, :location)";
$command = $connection->createCommand($sql);
$command->bindParam(":code", $code_area);
$command->bindParam(":city", $city);
$command->bindParam(':main_city_code', $main_city_code);
$command->bindParam(':location', $location);
foreach ($rawdatas as $codes) {
$code = explode(',', $codes);
for ($i = 0; $i < 4; $i++) {
$code[$i] = trim($code[$i]);
}
$code_area = $code[0];
$city = $code[1];
$main_city_code = $code[2];
$location = $code[3];
$exec = $command->execute();
}
$transaction->commit();
} catch (Exception $e) {
CVarDumper::dump($e, 10, TRUE);
exit;
$transaction->rollBack();
}
}
}
$this->render("importcsv", array('model' => $model));
}
示例13: dump
/**
* Debug функция, использемая только для отладки
*
* @param $var
* @param int $skipCount
* @param int $depth
*/
function dump($var, $skipCount = 0, $depth = 2)
{
static $startSkipCount = 0;
static $localSkipCount = 0;
if ($startSkipCount == 0) {
$startSkipCount = $localSkipCount = $skipCount;
} else {
$localSkipCount--;
}
if ($localSkipCount == 0) {
$startSkipCount = 0;
$isNotConsole = !defined('STDIN');
echo $isNotConsole ? '<pre>' : '';
CVarDumper::dump($var, $depth, $isNotConsole);
echo $isNotConsole ? '</pre>' : '';
exit;
}
}
示例14: run
/**
* Deciding if we are running the command locally or on Iron Workers
* @see CConsoleCommand::run()
* @param $args array
* @return If run locally the exit code. If run as IronWorker the ironWorker id.
*/
public function run($args)
{
//Store the parameters passed to the function, will be used to pass on to the iron workers
$this->yiicParams = $args;
//Add in the command name
array_unshift($this->yiicParams, $this->getName());
//Add in the entry script name
array_unshift($this->yiicParams, "./" . $this->getCommandRunner()->getScriptName());
CVarDumper::dump($this->yiicParams, 100, false);
if ($this->isIronWorker()) {
$this->ironWorker = true;
//Kick the command off to Iron Workers
$resId = $this->runAsIronWorker();
echo "Task " . $resId . " pushed to Iron Worker!\n";
//When run as an iron worker we return the IronWorker id
return $resId;
} else {
parent::run($args);
}
}
示例15: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Activity();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Activity'])) {
$model->attributes = $_POST['Activity'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->activity_id));
}
}
if (isset($_POST['ActivityForm']) || isset($_GET['activity_id'])) {
if (!Yii::app()->user->isGuest) {
if (isset($_POST['ActivityForm']) && $_POST['ActivityForm']['activity_id'] == 0) {
$model->attributes = $_POST['ActivityForm'];
$model->author_id = Yii::app()->user->getId();
$model->save();
$activity_id = $model->activity_id;
} elseif (isset($_GET['activity_id'])) {
$activity_id = $_GET['activity_id'];
} else {
$activity_id = $_POST['ActivityForm']['activity_id'];
}
$link = new ActivityUser();
$link->activity_id = $activity_id;
$link->user_id = Yii::app()->user->getId();
if (!$link->save()) {
CVarDumper::dump($link->getErrors(), 10, true);
exit;
}
}
// if ($model->save())
$this->redirect(array('site/index'));
}
$this->render('create', array('model' => $model));
}