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


PHP Storage::append方法代码示例

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


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

示例1: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     // Query the CUCM to get numbers in the None partition
     $res = Utils::executeQuery('SELECT dnorpattern, description FROM numplan WHERE fkroutepartition IS NULL AND tkpatternusage = 2', $this->cluster);
     // Create a line in the CSV for the Cluster heading
     Storage::append($this->outFile, $this->cluster->name . ',' . $this->cluster->ip);
     //If we got results.....
     if ($res) {
         //Add the results to our CSV file
         foreach ($res as $dn) {
             Storage::append($this->outFile, implode(",", [$dn->dnorpattern, $dn->description]));
         }
     }
 }
开发者ID:sloan58,项目名称:uc-insight-esk,代码行数:19,代码来源:GetDnsInNonePartition.php

示例2: getConnections

 /**
  * getConnections() function fetches all connections from
  * connection and table specified. Then returns a path
  * to a configuration file which gets imported and
  * deleted.
  *
  * @param $connection
  * @param $table
  * @return null|string
  */
 public static function getConnections($connection, $table)
 {
     $connections = DB::connection($connection)->table($table)->get();
     if (!empty($connections)) {
         /**
          * Create an empty array which will get populated with the data from
          * $connections in the correct format within the foreach statement
          * below file generation.
          */
         $config = array();
         /**
          * Generate a random string for the filename as it is temporary
          * and more secure.
          */
         $random_string = ConnectionLoader::random_string(35);
         /**
          * Append the .php extension to the file name and store here
          * storage_path/app/$tempFile with some starting content.
          */
         $tempFileName = $random_string . '.php';
         $tempFile = Storage::disk('local')->put($tempFileName, '<?php return ');
         if ($tempFile === true) {
             /**
              * Loops through the connections checking the driver and pushes
              * correctly formatted array into the $config array.
              */
             foreach ($connections as $connection) {
                 $name = $connection->name;
                 $driver = $connection->driver;
                 if ($driver == 'sqlite') {
                     $connection_config = array('driver' => $driver, 'database' => database_path($connection->database), 'prefix' => $connection->prefix);
                     $config[$name] = $connection_config;
                 } elseif ($driver == 'mysql') {
                     $strict = $connection->strict;
                     if ($strict == 1) {
                         $strict = true;
                     } else {
                         $strict = false;
                     }
                     $password = $connection->password;
                     if (empty($password)) {
                         $connection_config = array('driver' => $driver, 'host' => $connection->host, 'database' => $connection->database, 'username' => $connection->username, 'password' => $password, 'charset' => $connection->charset, 'collation' => $connection->collation, 'prefix' => $connection->prefix, 'strict' => $strict);
                     } else {
                         $connection_config = array('driver' => $driver, 'host' => $connection->host, 'database' => $connection->database, 'username' => $connection->username, 'password' => Crypt::decrypt($password), 'charset' => $connection->charset, 'collation' => $connection->collation, 'prefix' => $connection->prefix, 'strict' => $strict);
                     }
                     $config[$name] = $connection_config;
                 } elseif ($driver == 'pgsql') {
                     $password = $connection->password;
                     if (empty($password)) {
                         $connection_config = array('driver' => $driver, 'host' => $connection->host, 'port' => $connection->port, 'database' => $connection->database, 'username' => $connection->username, 'password' => $password, 'charset' => $connection->charset, 'prefix' => $connection->prefix, 'schema' => $connection->schema);
                     } else {
                         $connection_config = array('driver' => $driver, 'host' => $connection->host, 'port' => $connection->port, 'database' => $connection->database, 'username' => $connection->username, 'password' => Crypt::decrypt($password), 'charset' => $connection->charset, 'prefix' => $connection->prefix, 'schema' => $connection->schema);
                     }
                     $config[$name] = $connection_config;
                 }
             }
             /**
              * Append a var_export of $config to the temporary file and
              * append the semicolon.
              *
              * Returns the temporary filename.
              */
             $endFile = ';';
             Storage::append($tempFileName, var_export($config, true));
             Storage::append($tempFileName, $endFile);
             return $tempFileName;
         } else {
             \error_log('Unable to create temporary file');
         }
     } else {
         \error_log('Configuration File Connection Invalid.');
         return null;
     }
 }
开发者ID:laralabs,项目名称:connection-loader,代码行数:84,代码来源:ConnectionLoader.php


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