How to create new empty database with Laravel over Model(如何使用 Laravel over Model 创建新的空数据库)
问题描述
有没有办法用 Laravel
CodeBehind 创建新数据库?我的意思是,我无法使用 php artisan
或类似的东西.只是因为我想为每个注册用户创建一个数据库.之后我可以使用migration
.我正在使用 Laravel 5.2
.已经感谢您的支持.
is there any way to create new database with Laravel
CodeBehind ? I mean, I'm not able to use php artisan
or something like that. Just because I want to create a database for every registered user. After that I can use migration
.
I'm using Laravel 5.2
.
Thanks for your support already.
推荐答案
好吧,你可以为每个 bd 执行一个数据库查询,然后使用 mysql 或你的 sgbd database create 命令,例如;
well, you could perform a database query for each bd and than use the mysql or you sgbd database create command, for eg;
DB::getConnection()->statement('CREATE DATABASE :schema', array('schema' => "dasdsdasdsadsadsa"))
它可能会满足您的需求.
It probably will work with what you want.
这篇关于如何使用 Laravel over Model 创建新的空数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 Laravel over Model 创建新的空数据库


基础教程推荐
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 如何替换eregi() 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01