Я пытаюсь исправить проблемный код, вызвавший преобразование массива в строку, но не могу найти проблему.
Это код конфигурации плагина из программы под названием "blessing-skin", я пытался изменить несколько массивов, но он недействителен.
<?php
$targetDbConfigForm = Option::form('connection', 'database setting', function ($form) {
$form->text('forum_db_config[host]', 'TargetSqlAddress')->hint('There may be a delay in interfacing between database hosts, so please be aware.');
$form->text('forum_db_config[port]', 'port');
$form->text('forum_db_config[database]', 'database');
$form->text('forum_db_config[username]', 'username');
$form->text('forum_db_config[password]', 'password');
$form->text('forum_db_config[table]', 'table');
$form->select('forum_duplicated_prefer', 'duplicated prefer')
->option('remote', 'Use remote data')
->option('local', 'Use local data')
->description('After this selection, if the user data (such as the same user name and different username and password) conflicts, the option you choose will be used, and the user data of the other party will be overwritten.');
})->handle()->always(function ($form) {
$config = request('forum_db_config');
if ($config) {
option(['forum_db_config' => serialize($config)]);
} else {
$config = @unserialize(option('forum_db_config'));
}
config(['database.connections.remote' => array_merge(
forum_get_default_db_config(), (array) $config
)]);
try {
DB::connection('remote')->getPdo();
if (Schema::connection('remote')->hasTable($config['table'])) {
$form->addMessage('Connected', 'success');
} else {
$form->addMessage("Connected to databse,but table [{$config['table']}] not found.", 'warning');
}
} catch (Exception $e) {
$form->addMessage('Cannot connect to MySQL server. <br>Error info: '.$e->getMessage(), 'danger');
}
});
?>
Найти причину преобразования массива в строку.