是手册中
#所有的语言文件都是返回一个数组例如:
// resource/translations/en/messages.php
return [
    'hello' => 'Hello webman',
];需要加入<?php
改为
// resource/translations/en/messages.php
<?php
return [
    'hello' => 'Hello webman',
];模板中使用多语言时报错
TypeError: Symfony\Component\Translation\Loader\PhpFileLoader::loadResource(): Return value must be of type array, int returned in /vendor/symfony/translation/Loader/PhpFileLoader.php:33trans('login');TypeError: Symfony\Component\Translation\Loader\PhpFileLoader::loadResource(): Return value must be of type array, int returned in /vendor/symfony/translation/Loader/PhpFileLoader.php:33#报错文件,错误发生在此处的18行 return require $resource;
namespace Symfony\Component\Translation\Loader;
class PhpFileLoader extends FileLoader
{
    private static ?array $cache = [];
    /**
     * {@inheritdoc}
     */
    protected function loadResource(string $resource): array
    {
        if ([] === self::$cache && \function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN) && (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) || filter_var(\ini_get('opcache.enable_cli'), \FILTER_VALIDATE_BOOLEAN))) {
            self::$cache = null;
        }
        if (null === self::$cache) {
            return require $resource;
        }
        if (isset(self::$cache[$resource])) {
            return self::$cache[$resource];
        }
        return self::$cache[$resource] = require $resource;
    }
}
最新版本webman
环境为php80 opcache已开启 原生模板
语言包已建立且无误