Laravel 空格语法错误,意外标记 "readonly"

Laravel Spatie syntax error, unexpected token "readonly"

我遇到这个错误有人知道如何解决这个问题吗?

它在本地服务器上工作正常,但是当我们在无服务器服务器上设置时它会抛出这个错误。

syntax error, unexpected token "readonly" (View: /workspace/resources/views/backend/teams/form.blade.php)

在 /workspace/vendor/spatie/laravel-html/src/Elements/Input.php(第 23 行)

    use Autofocus;    
    use Disabled;    
    use MinMaxLength;    
    use Name;    
    use Placeholder;    
    use Readonly;    
    use Required;    
    use Type;    
    use Value;

使用只读;是第 23 行

不应该是'readonly'而不是Readonly。只是在黑暗中拍摄。

虽然也可能与你的系统和服务器上的不同PHP版本有关/

正如@Nigel Ren 提到的那样,PHP 8.1 出现了问题,readonly 现在是该语言的一部分。我将 PHP 版本降级到 7.4,它开始工作了。

但是,如果您愿意更新库,那么这是正确的解决方案。