问题标签 [phalcon-routing]

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 回答
94 浏览

php - Phalcon 中的电子邮件错误

我是 phalcon php 的新用户我在尝试使用 Phalcon Php 发送电子邮件时遇到问题 下面给出了错误的屏幕截图

错误图像

0 投票
1 回答
161 浏览

php - Phalcon 3.0 到 Phalcon 2.0 的兼容性

我用 Devtools 3.0 创建了一个准系统 Phalcon 3.0 项目,它在我的机器上运行良好然后我上传到我的网络主机服务,它重现了错误消息: Argument 1 passed to Phalcon\Di\Injectable::setDI() must implement interface Phalcon\DiInterface, instance of Wegawe\Modules\Frontend\Module given in /home/wewe/web/app/modules/frontend/Module.php on line 41

然后我意识到我的网络主机服务使用的是 Phalcon 2.0 而不是 Phalcon 3.0

有什么技巧可以解决这个问题吗?对不起,我的英语不好。:D

这是我的应用程序/bootstrap_web.php:

应用程序/模块/前端/Module.php:

0 投票
1 回答
85 浏览

php - mvc 中的 url 重定向。我想将 localhost/windshield-replacement.html 重定向到 localhost/greenvalleyaz

我的应用程序现在位于 phalcon php 框架中。我想重定向一个最后包含 .html 的 url。为了重定向,我将控制器名称写为WindshieldReplacementHtmlController.php但由于中间的点我无法重定向。我该如何解决这个问题?

重定向自:

当我键入localhost/windshield-replacement-html它重定向到目标但当我使用localhost/windshield-replacement.html它时没有检测到控制器。这是正确的方法吗?

0 投票
1 回答
104 浏览

php - Phalcon 2.x and 3.x routing breaks using regex or placeholder

Had to do a local dev system rebuild on my laptop running OSX, installed same Apache/2.4, PHP/5.6.27, and Phalcon/2.0.7 packages. Server code appears to be working correctly aside from routing (and .htaccess code is correct and adding to _url appropriately)

Original routing code:

That route previously worked for all URIs, from /user (show user list), to /user/1234 (view user), to actions like /user/do_action/1234. I never addressed routing more in-depth since that route just worked. The code as is also is working in production (I'm mirroring the libraries used in production, and am getting different behavior locally, but I'm also not seeing what else could be different that's causing the divergent behavior).

Upon local reinstallation, those paths no longer work, defaulting everything as if it was just /index/index. I can't figure out why that route no longer is appropriate, considering I'm using the same Phalcon/Apache/PHP/etc versions as before (and in production).

In terms of workarounds, I'm trying more explicit paths. These work:

However no dynamic routing methods work (anything with regex, placeholder, variables):

I've done a ton of research on this and nothing makes sense, other than it appears the variables/regex are a common problem. I don't mind writing a script to generate all possible routes by scanning the Controller files, but that would still require the {id:\d+} to work to pull ID numbers, but that's a nonstarter at this point.

I have also verified PCRE is installed and working (Phpinfo shows php was compiled with --with-pcre-regex and is enabled, library version 8.02 2010-03-19.)

Thank you in advance! I also tried upgrading to the newer Phalcon/3.0.1 and see the same routing issues. I figured I'd try and solve it in 2.0.7 since that's where production is currently, and I'll save that other upgrade for another day.

EDIT 1: Including httpd.conf and httpd-ssl.conf

httpd-ssl.conf

.htaccess

0 投票
0 回答
178 浏览

php - 控制器不工作

我最近开始使用 Phalcon 框架。除了一个小例外,它看起来非常好 - 我无法让控制器工作。这就是我所拥有的:

因此,当我转到 localhost/ - 一切正常时,我看到了这条消息 - “Hello from IndexController/indexAction”。但是,当我转到 localhost/login 或 localhost/user/login 时,我看到了相同的错误消息,即未找到请求的 url。我不确定这有什么问题,我该如何解决。

编辑

我刚刚创建了 routes.php 文件并在我的引导文件中使用它。但是,我看到由于某种原因,除此之外的所有路线都/被忽略了。所以,这就是它的样子:

所以,我看到这个 routes.php 确实被使用了,因为当我转到 localhost 时,我现在看到来自 UserController loginAction 的消息。但是,当我转到 localhost/login 时,我仍然看到臭名昭著的“未找到”错误消息。我真的很想知道,为什么 Phalcon 会忽略除/.

编辑

所以,我在我的 indexAction 中回显了 phpinfo 并在Configuration标题下看到了这个:

Loaded Modules: core mod_win32 mpm_winnt http_core mod_so mod_php7 mod_access_compat mod_actions mod_alias mod_allowmethods mod_asis mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dir mod_env mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_proxy mod_proxy_http mod_rewrite mod_setenvif

如您所见, mod_rewrite 已启用。

编辑

这就是我的 apache 配置文件的样子:

似乎我已经掌握了所有的拼图,但它仍然不起作用。

编辑

解决方案是创建具有以下内容的 htaccess 文件:

并将其放在公用文件夹中。无需其他 htaccess 文件和其他 apache 配置即可使其工作。希望它会帮助某人。

0 投票
1 回答
1398 浏览

php - Phalcon 3.04 IndexController 处理程序类无法加载

我用这个命令做了一个模块类型的项目

当我通过使用此命令在名为管理员的项目中添加新模块时

我已经在 config/loader.php 上添加了模块 在 config/loader.php

在 bootsrap_web.php 上

在此处输入图像描述

在 Module.php 上

在此处输入图像描述

当我尝试访问模块时,就会发生这种情况 在此处输入图像描述

索引控制器.php

在此处输入图像描述

希望有人帮助我解决这个问题。

0 投票
2 回答
214 浏览

phalcon - Phalcon Micro - 安全路线

我刚刚开始为我的 RestAPI 试用 Phalcon Micro。

一切都运行良好,但我似乎无法弄清楚如何保护某些路线,但不是其他路线。

有没有人在这方面有任何经验?- 我来自 Slim,我可以在实际路由定义中传递函数。

干杯,

0 投票
1 回答
381 浏览

phalcon - Phalcon 路由不工作,所有 url 访问索引

我使用 phalcon-dev-tools-v2.0.13 创建了一个名为的项目test,我访问了 root url "/",它起作用了!然后,我更改了一些代码,如下所示: 在此处输入图像描述

有效!

在此处输入图像描述

但:

在此处输入图像描述

我添加了另一个网址,它不起作用!

在此处输入图像描述

怎么了?我是 Phalcon 的新手,我关注了 Phalcon 的文档。我的系统是php5.6.30 Phalcon2.0.13nginxconf文件是:

0 投票
1 回答
426 浏览

rest - Phalcon REST API 结构

我正在使用 Phalcon 开发 REST API。该应用程序将有多个模块,如用户、公司、联系人等。这些模块中的每一个都有自己的用于存储数据的表。此外,每个模块都有自己的定义文件,其中提到了要在 API 响应中显示的字段。我对 Phalcon 很陌生,我刚开始学习 Phalcon,我需要有关如何构建应用程序的帮助,以便此代码不会给我未来的问题,或者如果我遗漏了什么或者代码是否可以抽象再多的话那就太好了。

计划中的目录结构:

我希望每个模块的所有与数据库相关的查询都驻留在它们自己的模型中。用于列出记录的 API URL 将是 http://api.example.com/MyAPI/V2/contacts/list或 /MyAPI/V2/users/list。同样,用于创建记录的 API URL 将是http://api.example.com/MyAPI/V2/contacts/add或 /MyAPI/V2/users/list

请告知我应该如何进行

0 投票
1 回答
568 浏览

phalcon - Phalcon\Micro:执行另一个控制器动作

我有一个在一台服务器上执行的控制器操作。此操作必须触发两个其他服务,这些服务可以位于同一台服务器或其他服务器上(取决于配置的路由)。目前我总是使用 HTTP 请求。但是,如果服务在同一台服务器上,我宁愿直接调用适当的控制器(取决于 url,尊重自定义路由)。

我的请求代码如下所示: