當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。