记录下自己的错误
一、
1、原因是没有pdo扩展导致的,
2、解决办法:打开php.ini,然后去掉以下两行代码之前的分号(;)即可。如下;
extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
二、
但是我运行pdo链接,还是报这个错。最后发现是自己的pdo链接字符串有问题,导致无法连接。原因是单引号与双引号的作用没有搞明白,单引号下的变量是php是不会去解析的,双引号与没有符号下的变量php才会去解析。
原文:https://blog.csdn.net/sinat_34322082/article/details/80417002
以上方法都不对的情况下:
本地环境:
发现在本地使用PHPstorm中执行php artsian insert:order 命令执行失败,无法找到驱动,最后发现在vagrant搭建的环境中,本地配置不全,在使用Xshell连接到这机器即可
vagrant环境
php artisan make:command Building/InsertOrder
生成的脚本文件存储在command/building 目录下,带命名空间
脚本文件:InsertOrder.PHP
<?php namespace AppConsoleCommandsBuilding; use AppBuilding; use AppModelListBuildingsBuildingPaymentTest; use IlluminateConsoleCommand; class InsertOrder extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'Insert:order'; /** * The console command description. * * @var string */ protected $description = '修改补充buildingpayment表中的订单编号'; /** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); } /** * Execute the console command. * * @return mixed */ public function handle() { //补充订单编号 $this->index(); } /** * @author lxw */ public function index() { $buildingsTest = BuildingPaymentTest::get(['id', 'building_id', 'created_at']); if ($buildingsTest->isEmpty()) { dd('没有数据'); } $num = 0; foreach ($buildingsTest as $building) { $createTime = date('Ymd', strtotime($building['created_at'])); //生成唯一订单编号,规则:年月日+5位随机数 $randStr = $createTime . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); $companyId = Building::where('id', $building->building_id)->withTrashed()->get(['company_id'])->toArray(); if (empty($companyId)) { continue; } $updateParam = [ 'order_id' => $randStr, 'company_id' => $companyId[0]['company_id'], 'owner_id' => 1, 'sales_person' => 'admin', 'payment_amount' => '0', 'start_time' => $building['created_at'], ]; BuildingPaymentTest::where('building_id', $building->building_id)->update($updateParam); $num++; dump('楼宇' . $building->building_id . '完成,已经完成' . $num . '条'); // dd('停止一下'); } dd('全部完成'); } }