求助有用 upupw 搭建 Laravel 的吗?

D:\UPUPW\vv

Symfony\Component\Debug\Exception\FatalThrowableError

Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()

http://test.com/public/index.php/

Hide solutions

Database name seems incorrect

You’re using the default database name laravel. This database does not exist.

Edit the .env file and use the correct database name in the DB_DATABASE key

Read more

    • 25

      D:\UPUPW\vv\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php

      Illuminate\Encryption\Encrypter

      :84

    • 24

      D:\UPUPW\vv\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php

      Illuminate\Cookie\Middleware\EncryptCookies

      :139

    • 23

      Illuminate\Cookie\Middleware\EncryptCookies

      :66

    • 22

      Illuminate\Pipeline\Pipeline

      :171

    • 21

      Illuminate\Pipeline\Pipeline

      :105

    • 20

      Illuminate\Routing\Router

      :683

    • 19

      Illuminate\Routing\Router

      :658

    • 18

      Illuminate\Routing\Router

      :624

    • 17

      Illuminate\Routing\Router

      :613

    • 16

      Illuminate\Foundation\Http\Kernel

      :177

    • 15

      Illuminate\Pipeline\Pipeline

      :130

    • 14

      Illuminate\Foundation\Http\Middleware\TransformsRequest

      :21

    • 13

      Illuminate\Pipeline\Pipeline

      :171

    • 12

      Illuminate\Foundation\Http\Middleware\TransformsRequest

      :21

    • 11

      Illuminate\Pipeline\Pipeline

      :171

    • 10

      Illuminate\Foundation\Http\Middleware\ValidatePostSize

      :27

    • 9

      Illuminate\Pipeline\Pipeline

      :171

    • 8

      Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode

      :62

    • 7

      Illuminate\Pipeline\Pipeline

      :171

    • 6

      Fideloper\Proxy\TrustProxies

      :57

    • 5

      Illuminate\Pipeline\Pipeline

      :171

    • 4

      Illuminate\Pipeline\Pipeline

      :105

    • 3

      Illuminate\Foundation\Http\Kernel

      :152

    • 2

      Illuminate\Foundation\Http\Kernel

      :117

    • 1

      :55

Illuminate\Encryption\Encrypter::encrypt :84

D:\UPUPW\vv\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php:84

{

return random_bytes($cipher === ‘AES-128-CBC’ ? 16 : 32);

}

/**

  • Encrypt the given value.

  • @param mixed $value

  • @param bool $serialize

  • @return string

  • @throws \Illuminate\Contracts\Encryption\EncryptException

  • /

    public function encrypt($value, $serialize = true)

    {

    $iv = random_bytes(openssl_cipher_iv_length($this->cipher));

    // First we will encrypt the value using OpenSSL. After this is encrypted we

    // will proceed to calculating a MAC for the encrypted value so that this

    // value can be verified later as not having been changed by the users.

    $value = \openssl_encrypt(

    $serialize ? serialize($value) : $value,

    $this->cipher, $this->key, 0, $iv

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
讨论数量: 3
sunxyw

根据报错信息,推断是数据库不存在导致的。

解决方案:建立一个新的数据库(使用 utf8mb4 编码),再修改 .env 文件中的 DB_DATABASE 为相应的数据库名称。
参考:文档 - 数据库快速入门

另外,下次发代码(报错信息)的时候,请尽量使用代码高亮。

如果此文对你有帮助,请不要吝啬你的 最佳答案 :smile:

补充:刚去搜了一下,此问题也有可能是缺少 openssl 扩展导致的,可以在 php.ini 文件中 extension=php_openssl.dll 前面的 ; 去掉。然后重启 PHP-FPM ,如果你用的是 Apache,那么请重启 Apache 。

4年前 评论
cqsskk (楼主) 4年前
suntao_cool 3年前
php炎黄

laragon不香嘛

3年前 评论

检查一下 env 中的数据库配置是否正确呢?根据提示似乎还是默认数据库名 laravel 哦

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!