javascript 脚本源不会被浏览器 zendframework 找到

javascript script source won't be found by browser zendframework

我正在尝试将脚本导入到我的 .phtml 文件中。

<body>

<SCRIPT type="text/javascript" src="script.js"></SCRIPT>

</body>

但是浏览器控制台returns给我一个错误信息: 加载源错误 "http://myhost/a/script.js"

我的项目结构是:

app/module/someName/view/a/b/script.js

app/module/someName/view/a/b/index.phtml

我可以将位于同一目录中的 php 文件包含到我的 index.phtml 中。但是不知何故,当我想包含 java 脚本代码时,我得到了一个错误。

我的猜测是我将 InvokableFactory 与我的控制器一起使用。有什么相关性吗?

module.config.php

'router' => [
        'routes' => [
            'a' => [
                'type' => Literal::class,
                'may_terminate' => true,
                'options' => [
                    'route' => '/a',
                    'constraints' => [
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'id' => '[a-zA-Z][a-zA-Z0-9_-]*',
                    ],
                    'defaults' => [
                        'controller' => MonitoringController::class,
                        'action' => 'index',
                    ],
                ],
                'child_routes' => [


            'b' => [
                'type'    => Segment::class,
                'options' => [
                    'route' => '/b[/:action[/:id]]',
                    'constraints' => [
                        'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'id'     => '[0-9]+',
                    ],
                    'defaults' => [
                        'controller' => DashboardController::class,
                        'action'     => 'index',
                    ],
                ],
            ],

尝试将 src="script.js" 替换为 src="/b/script.js"

我用 php 导入了脚本,现在运行良好。

$this->inlineScript()->appendFile($this->basePath('pathTo/javaScriptFile.js'));