问题标签 [mezzio]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
235 浏览

php - 是否可以使用 Zend Servicemanager 管理中间件?

我使用Zend Expressive作为 API。我已经成功添加了一个中间件,它为每个请求验证 API 密钥的请求标头。

目前我使用 config/pipeline.php 中的 pipe() 函数添加中间件

这实际上工作得很好。但是,我想使用 Zend Servicemanager 添加管道,而不是使用配置文件,例如:

问题:是否可以使用 Zend Servicemanager 管理中间件?如果是的话。

0 投票
1 回答
214 浏览

php - 在 Zend Expressive 2 中编写自定义助手

我正在编写自定义助手,一切正常。但我不知道如何传递参数......

在 config/autoload/templates.global.php

我还有这个:

如果我使用构造函数,我会收到错误...是否建议使用 __invoke() 传递参数来构建我的类?

谢谢!

0 投票
1 回答
520 浏览

php - 在 Zend Expressive 的视图中获取当前路线名称?

我正在尝试获取当前路由名称以便能够在视图中执行一些逻辑。我需要在视图中检索它,而不是在控制器中。例如,在 laravel 中,如果我想测试我会使用的路线Request::is('admin/dashboard')Route::current()->getName().

我用谷歌搜索了很多次,但我在任何地方都没有找到这个答案。

0 投票
1 回答
41 浏览

apache - mod_rewrite 配置无法路由到运行 Zend Expressive 的 PHP 文件

我正在尝试设置 Zend Expressive 并遵循本教程: https ://zend-expressive.readthedocs.io/en/latest/cookbook/using-a-base-path/

在我看来,我的 mod_rewrite 指令没有得到遵守。
如何确保 Apache 尊重我.htaccess文件中的指令?

0 投票
1 回答
268 浏览

php - Zend 富有表现力 - 布局

在我的布局(Twig)中,我想从Middleware authentication中检索一个值。

如果我把,在templates.global.pĥp:

并在布局 default.html.twig

这段代码有效,但是,它是一个好方法吗?

谢谢 :)

0 投票
1 回答
548 浏览

php - Zend 表达布局变量

Zend 富有表现力 - 布局

https://github.com/zendframework/zend-expressive-twigrenderer/issues/24

基于这个问题,我想将一个变量从一个动作传递给布局我该如何尝试呢?

在我的layout/default.phtml

0 投票
1 回答
51 浏览

php - Export to Excel error - repeat same column on this script

what is wrong on my script, export goes well but repeat the first column on all results fields. I dont want to download the file, just save it and its alright until here. Header sabe OK, but line keep the same on all 30 results. what I am doing wrong?

I try a lot of different ways to write the line to file xls. But always the same result. The loop goes well if u print $dataExport[$a]['post_title'] will show all title but when I write the $line variable it repeat the first result.

0 投票
1 回答
1385 浏览

php - 什么是 Zend Expressive 和 Zend MVC?

我正在用 PHP 开始一个新项目,并想选择最新的 ZendFramework。我看到 Zend Framework 3 已经发布,所以我想从 Zend Framework 3 本身开始。但是当我进入 Zend 的安装页面时,他们给出了 Zend MVC 和 Zend expressive 等选项。

我阅读了它们并了解到 Expressive 是一个微框架,而 MVC 是一个全栈框架。除此之外,我对它们不是很清楚。

我看到 Zend MVC 也用于 ZF2,并且文档将MVC 作为一个层。我找不到 zf2 的表现力。

问题:

  1. Zend MVC 和 Zend Expressive 都是包吗?是zf3的一部分吗?
  2. 当我在 Zend MVC 和 Zend Expressive 中看到已安装的包时,我看不到 Zend 框架的包,但我看到 Zend 组件的单独包,例如zend-httpzend-json等。这些(表达和 MVC)只是建立在不同的Zend 组件?
  3. 我怎么知道我正在使用 ZF3?
0 投票
1 回答
177 浏览

zend-framework - Zend Expressive 2 上 Zend\Db\TableGateway\TableGateway 中不同表的关系

我尝试在 GitHub 上遵循本教程(https://github.com/lowtower/zend-expressive2-tutorial

我理解一切(我认为),但我想知道,如果我需要使用 TableGateway 接口关联不同的表会发生什么?

以上述教程为指导,如果我的相册与我数据库中的其他表相关,我该如何在 AlbumTableGateway 中实现呢?例如,如果我有另一个名为类别的表...

或者干脆我必须放弃使用 TableGateway 接口,如果是这样,我如何在本指南中实施这个新解决方案?

0 投票
1 回答
68 浏览

php - 如何使用 phly-expressive-oauth2clientauthentication 模块进行 zend-expressive

嗨,

我想在我的表达应用程序中使用这个模块( https://github.com/phly/phly-expressive-oauth2clientauthentication )。

我读了这个文档https://phly.github.io/phly-expressive-oauth2clientauthentication

这是我所做的:

在我的 config/autoload 文件夹中,我用这个数组添加了一个 oauth2clientauthentication.global.php :

在我的 pipeline.php 文件中我添加

在我的 ConfigProvider.php 文件中,我使用此配置添加了一条路由(我使用带有https://github.com/acelaya/expressive-slim-router的超薄路由器:

当我尝试这个网址时:' http://blog/admin ',我得到了带有 github 按钮的未经身份验证的页面。但是当我点击按钮时,网址是:' http://blog/auth/github?redirect=http://blog/admin '并得到一个错误:

我不明白问题出在哪里,有人有解决这个问题的想法吗?