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


PHP VarDumper::export方法代码示例

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


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

示例1: format

 public function format($response)
 {
     $response->getHeaders()->set('Content-Type', 'text/php; charset=UTF-8');
     if ($response->data !== null) {
         $response->content = "<?php\nreturn " . VarDumper::export($response->data) . ";\n";
     }
 }
开发者ID:CDIO3,项目名称:biosafe,代码行数:7,代码来源:PhpArrayFormatter.php

示例2: export

 /**
  * Stores log messages to DB.
  */
 public function export()
 {
     $tableName = $this->db->quoteTableName($this->logTable);
     $sql = "INSERT INTO {$tableName} ([[level]], [[category]], [[log_time]], [[prefix]], [[message]], [[model]], [[blame]])\n                VALUES (:level, :category, :log_time, :prefix, :message, :model, :blame)";
     $command = $this->db->createCommand($sql);
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         $extracted = ['msg' => '', 'model' => null, 'blame' => null];
         if (is_array($text) && (isset($text['msg']) || isset($text['model']) || isset($text['blame']))) {
             if (isset($text['msg'])) {
                 if (!is_string($text['msg'])) {
                     $extracted['msg'] = VarDumper::export($text['msg']);
                 } else {
                     $extracted['msg'] = $text['msg'];
                 }
             }
             if (isset($text['model'])) {
                 $extracted['model'] = $text['model'];
             }
             if (isset($text['blame'])) {
                 $extracted['blame'] = $text['blame'];
             }
         } elseif (is_string($text)) {
             $extracted['msg'] = $text;
         } else {
             $extracted['msg'] = VarDumper::export($text);
         }
         $command->bindValues([':level' => $level, ':category' => $category, ':log_time' => $timestamp, ':prefix' => $this->getMessagePrefix($message), ':message' => $extracted['msg'], ':model' => $extracted['model'], ':blame' => $extracted['blame']])->execute();
     }
 }
开发者ID:Avenger1,项目名称:yii2-podium,代码行数:33,代码来源:DbTarget.php

示例3: getDirectories

 /**
  * @return array all directories
  */
 protected function getDirectories()
 {
     if ($this->_paths === null) {
         $paths = ArrayHelper::getValue(Yii::$app->params, $this->paramVar, []);
         $paths = array_merge($paths, $this->migrationLookup);
         $extra = !empty($this->extraFile) && is_file($this->extraFile = Yii::getAlias($this->extraFile)) ? require $this->extraFile : [];
         $paths = array_merge($extra, $paths);
         $p = [];
         foreach ($paths as $path) {
             $p[Yii::getAlias($path, false)] = true;
         }
         unset($p[false]);
         $currentPath = Yii::getAlias($this->migrationPath);
         if (!isset($p[$currentPath])) {
             $p[$currentPath] = true;
             if (!empty($this->extraFile)) {
                 $extra[] = $this->migrationPath;
                 FileHelper::createDirectory(dirname($this->extraFile));
                 file_put_contents($this->extraFile, "<?php\nreturn " . VarDumper::export($extra) . ";\n", LOCK_EX);
             }
         }
         $this->_paths = array_keys($p);
         foreach ($this->migrationNamespaces as $namespace) {
             $path = str_replace('/', DIRECTORY_SEPARATOR, Yii::getAlias('@' . str_replace('\\', '/', $namespace)));
             $this->_paths[$namespace] = $path;
         }
     }
     return $this->_paths;
 }
开发者ID:deesoft,项目名称:yii2-console,代码行数:32,代码来源:MigrateTrait.php

示例4: commit

    /**
     * Writes all configuration to application configuration file
     * @return bool result, true if success
     */
    public function commit()
    {
        $data = <<<PHP
<?php
/*
 * ! WARNING !
 *
 * This file is auto-generated.
 * Please don't modify it by-hand or all your changes can be lost.
 */
{$this->append}
return
PHP;
        $data .= VarDumper::export($this->configuration);
        $data .= ";\n\n";
        $result = file_put_contents($this->filename, $data, LOCK_EX) !== false;
        if ($result) {
            if (function_exists('opcache_invalidate')) {
                opcache_invalidate($this->filename, true);
            }
            if (function_exists('apc_delete_file')) {
                @apc_delete_file($this->filename);
            }
        }
        return $result;
    }
开发者ID:DevGroup-ru,项目名称:yii2-extensions-manager,代码行数:30,代码来源:ApplicationConfigWriter.php

示例5: saveConfigFile

 /**
  * Creates message command config file named as [[configFileName]].
  * @param array $config message command config.
  */
 protected function saveConfigFile(array $config)
 {
     if (file_exists($this->configFileName)) {
         unlink($this->configFileName);
     }
     $fileContent = '<?php return ' . VarDumper::export($config) . ';';
     file_put_contents($this->configFileName, $fileContent);
 }
开发者ID:albertborsos,项目名称:yii2,代码行数:12,代码来源:BaseMessageControllerTest.php

示例6: createDatabaseConfigFile

 /**
  * Write database configuration content in a file
  *
  * @param $config
  * @return bool
  */
 public static function createDatabaseConfigFile($config)
 {
     $content = VarDumper::export($config);
     $content = preg_replace('~\\\\+~', '\\', $content);
     // Fix class backslash
     $content = "<?php\nreturn " . $content . ";\n";
     return file_put_contents(Yii::getAlias('@app/config/db.php'), $content) > 0;
 }
开发者ID:ramialcheikh,项目名称:quickforms,代码行数:14,代码来源:SetupHelper.php

示例7: writeCommonConfig

 public static function writeCommonConfig(FinalStep $model)
 {
     $common_config = ['language' => Yii::$app->session->get('language'), 'components' => ['cache' => ['class' => $model->cacheClass, 'keyPrefix' => $model->keyPrefix]], 'modules' => ['core' => ['serverName' => $model->serverName, 'serverPort' => $model->serverPort]]];
     if ($model->cacheClass === 'yii\\caching\\MemCache') {
         $common_config['components']['cache']['useMemcached'] = $model->useMemcached;
     }
     return file_put_contents(Yii::getAlias('@app/config/common-local.php'), "<?php\nreturn " . VarDumper::export($common_config) . ';') > 0;
 }
开发者ID:lzpfmh,项目名称:dotplant2,代码行数:8,代码来源:InstallerHelper.php

示例8: writeData

 /**
  * @inheritdoc
  */
 public function writeData($fileName, array $data)
 {
     $fileName = $this->composeActualFileName($fileName);
     $content = "<?php\n\nreturn " . VarDumper::export($data) . ";";
     $bytesWritten = file_put_contents($fileName, $content);
     if ($bytesWritten <= 0) {
         throw new Exception("Unable to write file '{$fileName}'.");
     }
 }
开发者ID:rockefys,项目名称:filedb,代码行数:12,代码来源:FileManagerPhp.php

示例9: setRuntimeConfig

 public function setRuntimeConfig($config)
 {
     $path = $this->runtimeConfigDir();
     if (!is_dir($path)) {
         FileHelper::createDirectory($path);
     }
     $data = '<?php ' . "\nreturn " . VarDumper::export($config) . ';';
     file_put_contents($path . DIRECTORY_SEPARATOR . 'config.php', $data);
 }
开发者ID:chabberwock,项目名称:halo-dev,代码行数:9,代码来源:BasePlugin.php

示例10: formatMessage

 /**
  * @inheritdoc
  */
 public function formatMessage($message)
 {
     list($text, $level, $category, $timestamp) = $message;
     $level = Logger::getLevelName($level);
     if (!is_string($text)) {
         $text = VarDumper::export($text);
     }
     $prefix = $this->getMessagePrefix($message);
     return "{$prefix}[{$level}][{$category}] {$text}";
 }
开发者ID:dmstr,项目名称:yii2-log,代码行数:13,代码来源:SyslogTarget.php

示例11: export

 /**
  * @inheritdoc
  */
 public function export()
 {
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             $text = VarDumper::export($text);
         }
         $this->sendLog($text);
     }
 }
开发者ID:fernandezekiel,项目名称:yii2-papertrail,代码行数:13,代码来源:PaperTrailTarget.php

示例12: export

 /**
  * Stores log messages to MongoDB collection.
  */
 public function export()
 {
     $collection = $this->db->getCollection($this->logCollection);
     foreach ($this->messages as $message) {
         list($text, $level, $category, $timestamp) = $message;
         if (!is_string($text)) {
             $text = VarDumper::export($text);
         }
         $collection->insert(['level' => $level, 'category' => $category, 'log_time' => $timestamp, 'prefix' => $this->getMessagePrefix($message), 'message' => $text]);
     }
 }
开发者ID:avron99,项目名称:delayed-orders,代码行数:14,代码来源:MongoDbTarget.php

示例13: match

 /**
  * @inheritdoc
  */
 public function match($value)
 {
     if (!is_scalar($value)) {
         $value = VarDumper::export($value);
     }
     if ($this->partial) {
         return mb_stripos($value, $this->baseValue, 0, \Yii::$app->charset) !== false;
     } else {
         return strcmp(mb_strtoupper($this->baseValue, \Yii::$app->charset), mb_strtoupper($value, \Yii::$app->charset)) === 0;
     }
 }
开发者ID:yiisoft,项目名称:yii2-debug,代码行数:14,代码来源:SameAs.php

示例14: saveConfig

 public function saveConfig()
 {
     $this->beforeSave();
     $conf = $this->getAttributes();
     unset($conf['blockId'], $conf['widgetId'], $conf['comment']);
     $conf['__block'] = ['widgetId' => $this->widgetId, 'comment' => $this->comment, 'widgetClass' => DynBlockHelper::widgetClassById($this->widgetId, true), 'modelClass' => DynBlockHelper::widgetModelClassNameById($this->widgetId)];
     $s = VarDumper::export($conf);
     $s = "<?php\nreturn " . $s . ";";
     $fn = DynBlockHelper::configFile($this->blockId);
     file_put_contents($fn, $s);
 }
开发者ID:kintastish,项目名称:mobil,代码行数:11,代码来源:DynamicBlockModel.php

示例15: __construct

 /**
  * Constructor.
  *
  * @param Item $item
  * @param array $config
  */
 public function __construct($item, $config = [])
 {
     $this->_item = $item;
     if ($item !== null) {
         $this->name = $item->name;
         $this->type = (int) $item->type;
         $this->description = $item->description;
         $this->ruleName = $item->ruleName;
         $this->data = $item->data === null ? null : VarDumper::export($item->data);
     }
     parent::__construct($config);
 }
开发者ID:uqiauto,项目名称:wxzuan,代码行数:18,代码来源:AuthItemModel.php


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