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


PHP DB::getDatabaseName方法代码示例

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


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

示例1: dosyaOlustur

 public function dosyaOlustur($tableName)
 {
     $filename = $tableName;
     $databaseName = DB::getDatabaseName();
     header('Content-Encoding: UTF-8');
     header('Content-Type: text/plain; charset=utf-8');
     header("Content-disposition: attachment; filename=" . $filename . ".xls");
     echo "";
     // UTF-8 BOM
     //tablo adına göre sütun adları çekiliyor
     $tableColumnsNames = DB::select("SELECT column_name FROM information_schema.columns WHERE table_schema= ? and  table_name = ? ", array($databaseName, $tableName));
     // $tableData = DB::select("SELECT * FROM $tableName ORDER by id");
     $tableData = DB::table($tableName)->orderBy('id', 'asc')->get();
     // exceldeki görüntü oluşturuluyor(sütun isimlerinin yazıldığı kısım)
     echo "<table border=\"1\">";
     echo "<tr>";
     foreach ($tableColumnsNames as $columnsNames) {
         foreach ($columnsNames as $columnName) {
             echo "<th>{$columnName}</th>";
         }
     }
     echo "</tr>";
     //sütunlardaki verilerin yazıldığı kısım
     foreach ($tableData as $row) {
         echo "<tr>";
         foreach ($row as $value) {
             echo "<td>{$value}</td>";
         }
         echo "</tr>";
     }
     echo "</table>";
 }
开发者ID:hakanozer,项目名称:laravelAdmin,代码行数:32,代码来源:excelController.php

示例2: createApplication

 /**
  * Creates the application.
  *
  * @return Symfony\Component\HttpKernel\HttpKernelInterface
  */
 public function createApplication()
 {
     $this->test_db = DB::getDatabaseName();
     $unitTesting = true;
     $testEnvironment = 'testing';
     return require base_path() . '/bootstrap/start.php';
 }
开发者ID:andizzle,项目名称:zapper,代码行数:12,代码来源:ZapperTestCase.php

示例3: tableExists

 private function tableExists($table)
 {
     $dbname = DB::getDatabaseName();
     $field = 'Tables_in_' . $dbname;
     $tables = [];
     foreach (DB::select('SHOW TABLES') as $data) {
         $tables[] = $data->{$field};
     }
     return in_array($table, $tables);
 }
开发者ID:vergil-lai,项目名称:node-categoires,代码行数:10,代码来源:MigrationCommand.php

示例4: __construct

 /**
  * Create a new command instance.
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->default_db_type = DB::getName();
     $this->default_db_name = DB::getDatabaseName();
 }
开发者ID:andizzle,项目名称:zapper,代码行数:11,代码来源:ZapperCommand.php


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