如何修复mb_strpos()期望参数1为字符串,给定数组?

时间:2018-12-18 02:16:58

标签: php string laravel laravel-5 artisan

我负责php artisan服务,总是出现错误

  

php工匠服务

In Str.php line 107:
mb_strpos() expects parameter 1 to be string, array given

当我编写更新时,总是会出现相同的错误。

  

作曲家更新

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 3 updates, 0 removals
  - Updating doctrine/dbal (v2.9.0 => v2.9.1): Downloading (100%)
  - Updating opis/closure (3.1.1 => 3.1.2): Downloading (100%)
  - Updating laravel/framework (v5.7.17 => v5.7.18): Downloading (100%)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Str.php line 107:

  mb_strpos() expects parameter 1 to be string, array given


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

当我在第107行打开 Str.php 文件时,就像这样。

 public static function contains($haystack, $needles)
    {
        foreach ((array) $needles as $needle) {
            if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
                return true;
            }
        }

        return false;
    }

Stacktrace文件日志laravel:

[2018-12-19 09:55:41] local.ERROR: mb_strpos() expects parameter 1 to be string, array given {"exception":"[object] (ErrorException(code: 0): mb_strpos() expects parameter 1 to be string, array given at C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Str.php:107)
[stacktrace]
#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'mb_strpos() exp...', 'C:\\\\xampp-v7.2\\\\h...', 107, Array)
#1 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Str.php(107): mb_strpos(Array, '/')
#2 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ResourceRegistrar.php(82): Illuminate\\Support\\Str::contains(Array, '/')
#3 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\PendingResourceRegistration.php(166): Illuminate\\Routing\\ResourceRegistrar->register(Array, Object(Closure), Array)
#4 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\PendingResourceRegistration.php(178): Illuminate\\Routing\\PendingResourceRegistration->register()
#5 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(237): Illuminate\\Routing\\PendingResourceRegistration->__destruct()
#6 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\
outes\\web.php(40): Illuminate\\Support\\Facades\\Facade::__callStatic('resource', Array)
#7 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(413): Illuminate\\Routing\\Router->{closure}(Object(Illuminate\\Routing\\Router))
#8 C:\\xampp-v7.2\\htdocs\\sk-digital-v1\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(373): Illuminate\\Routing\\Router->loadRoutes(Object(Closure))
#9 

0 个答案:

没有答案