![](/img/trans.png)
[英]Laravel 4 on Mac localhost: Cannot find driver for SQLSRV
[英]laravel cannot find driver (after completing migrations)
这不是Laravel通常的“找不到驱动程序”错误消息。 我能够成功创建迁移并将其反映在数据库中。 但是,当我尝试插入或选择时,我收到以下错误:
QueryException in Connection.php line 647:
could not find driver (SQL: insert into .....
这是我的迁移文件:
public function up()
{
Schema::create('vendors', function (Blueprint $table) {
$table->increments('id');
$table->string('vendor_name');
$table->string('contact_name');
$table->string('phone_number');
$table->string('alt_phone_number');P
$table->string('email')->unique();
$table->string('address');
$table->timestamps();
});
}
这是我的RESTful模型中的store()方法:
public function store(Request $request)
{
//
Vendor::create(request(['vendor_name', 'contact_name', 'phone_number', 'alt_phone_number', 'email','address']));
this.index();
}
我知道请求是获取数据,因为我要做一个dd()
并完全查看内容。
这对我有用:
对于PDOException:找不到MySQL的驱动程序,如果它是基于Debian的操作系统,
sudo apt-get -y install php5-mysql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.