0
我使用laravel和Oracle開發應用程序,其中我使用laravel OCI8 的持久連接使用以下代碼我設置的應用程序/配置/ database.php中如何關閉持續康恩在laravel 5.4
'oracle' => array(
'driver' => 'oracle',
'tns' => env('DB_TNS', '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1521'),
'database' => env('DB_DATABASE', 'Test_DB'),
'username' => env('DB_USERNAME', 'admin'),
'password' => env('DB_PASSWORD', 'admin'),
'charset' => env('DB_CHARSET', 'AL32UTF8'),
'prefix' => env('DB_PREFIX', ''),
'options' => [
\PDO::ATTR_PERSISTENT => true
]
)
問題是我想在新用戶登錄到系統時重新創建數據庫連接。如何關閉連接laravel.please的幫助,我可以幫到我
will \ DB :: disconnect();關閉持續連接 –
是的,但是當您的腳本執行數據庫查詢時,laravel將重新連接。 –