国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

[已解決]在命令行中使用Db類(lèi)插入數(shù)據(jù)不起作用

fgt1t5y

問(wèn)題描述

在命令行中使用Db類(lèi)插入數(shù)據(jù)不起作用

程序代碼或配置

<?php

namespace app\command;

use support\Db;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;

class Migrate extends Command
{
    protected static $defaultName = 'user:create';

    protected function configure()
    {
        $this->addArgument('username', InputArgument::REQUIRED, 'Username');
        $this->addArgument('email', InputArgument::REQUIRED, 'User Email');
        $this->addArgument('password', InputArgument::REQUIRED, 'User Password');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        Db::connection('default')->table('users')->insert([
            'id' => 10,
            'display_name' => $input->getArgument('username'),
            'username' => $input->getArgument('username'),
            'password' => password_hash($input->getArgument('password')),
            'email' => $input->getArgument('email'),
            'avatar_uri' => '0',
            'allow_login' => 1
        ]);

        return self::SUCCESS;
    }
}

重現(xiàn)問(wèn)題的步驟

截圖

在命令行中允許命令后沒(méi)任何作用

操作系統(tǒng)環(huán)境及workerman/webman等具體版本

系統(tǒng):Windows11
PHP:8.1
Workerman:4.1.15
Webman:1.5.0
webman-console:1.3

274 1 0
1個(gè)回答

fgt1t5y

解決了,是password_hash少參數(shù)了

  • 暫無(wú)評(píng)論
??