记录下本身的错误php
1、mysql
一、缘由是没有pdo扩展致使的,sql
二、解决办法:打开php.ini,而后去掉如下两行代码以前的分号(;)便可。以下;shell
extension=php_pdo_firebird.dllui
extension=php_pdo_mysql.dllthis
2、spa
可是我运行pdo连接,仍是报这个错。最后发现是本身的pdo连接字符串有问题,致使没法链接。缘由是单引号与双引号的做用没有搞明白,单引号下的变量是php是不会去解析的,双引号与没有符号下的变量php才会去解析。.net
原文:https://blog.csdn.net/sinat_34322082/article/details/80417002
vagrant
以上方法都不对的状况下:3d
本地环境:
发如今本地使用PHPstorm中执行php artsian insert:order 命令执行失败,没法找到驱动,最后发如今vagrant搭建的环境中,本地配置不全,在使用Xshell链接到这机器便可
vagrant环境
php artisan make:command Building/InsertOrder
生成的脚本文件存储在command/building 目录下,带命名空间
脚本文件:InsertOrder.PHP
<?php namespace App\Console\Commands\Building; use App\Building; use App\ModelList\Buildings\BuildingPaymentTest; use Illuminate\Console\Command; 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('所有完成'); } }