问题标签 [cakephp-2.4]

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 投票
2 回答
1304 浏览

cakephp - CakeResque 插件不工作

我正在尝试在 cakephp 2.4 中使用 CakeResque 插件并按照链接遵循所有安装说明

http://kamisama.me/2012/10/16/background-jobs-with-php-and-resque-part-6-integration-into-cakephp/

当我发射命令时

得到错误

错误:无法加载类 CakeResqueShell。

任何帮助表示赞赏

谢谢

0 投票
1 回答
2189 浏览

shell - 运行 cakephp shell 时找不到类“应用程序”

下面是我的shell类

FriendShell.php

AppShell.php

参考问题

https://github.com/kamisama/Cake-Resque/issues/25

我删除了

现在使用

在 FriendShell.php 中

但问题仍然存在,因为 AppShell.php 使用

这就是为什么我在尝试运行该 shell时收到错误Class 'App' not found的原因。

任何帮助表示赞赏

谢谢

0 投票
1 回答
1127 浏览

php - 使用 CakeResque 作为后台进程发送电子邮件

MailShell.php

测试控制器.php

当我打开 URL

作业在默认队列中正确排队,请参阅

在此处输入图像描述

当我开始工作时,统计数据如下所示

在此处输入图像描述

对于每个作业,它会将处理的作业增加 1失败的作业增加 2,并且不发送电子邮件

什么是真正的问题?电子邮件发送程序有问题吗?CakeResque 有问题吗?

任何帮助表示赞赏

谢谢

0 投票
3 回答
4170 浏览

php - CakePHP generate pdf then send as email attachment

I'm using the TCPDF library to create invoices in my CakePHP application. If I go to /invoices/view/1 my view.ctp includes the code to generate and display the pdf in the browser. I want to add the ability to send the pdf as an email attachment so I created the action /invoices/send_invoice and copied the code from view.ctp into an email template.

Now where I'm stuck, I don't know how to have the PDF generated first before attaching it. At the end of my view.ctp page template I use

which sends the pdf to view in browser without creating the file. I can save the file if I use 'F' or 'FI' as the last parameter to $pdf->Output() but it's not guaranteed that the user will view the invoice before trying to send it as an email.

In my send_invoice action I need to have the pdf generated as a file in order to attach it with:

having the code that generates the pdf file in my email template means the file doesn't exist yet when I try to attach it. Is there some way to attach the file from the email template itself? I was thinking maybe I can write a function on my Invoice model to generate the pdf but I want to use some View Helpers (like the Number helper) to format my data. Can I execute the code in a view and then return to the controller/action without displaying the view?

0 投票
2 回答
8206 浏览

php - 如何在根域的子文件夹中运行 CakePHP 应用程序?

我正在尝试在子文件夹中设置一个 CakePHP 应用程序,但从根域运行它,例如,用户请求domain.co.uk,他们在{DOCUMENT_ROOT}/version-13/app/webroot.

托管设置不允许我更改文档根目录,因此我在根目录中有以下 .htaccess:

这似乎可以完成这项工作。但是,Cake 检测到子文件夹并将其添加到它创建的所有 URL(例如,$this->Form->create()操作等),因此我最终将表单发布到domain.co.uk/version-13/signup而不是domain.co.uk/signup.

我知道这可能会很简单,但我正在碰壁。无论我尝试什么,我都无法让它工作!

0 投票
1 回答
50 浏览

cakephp-2.4 - 我应该使用什么关联?

我有这样的表(例如,它的评论模型):

如何将此模型与 CakePHP 2.4 中的用户模型相关联?

PS对不起我的英语。

0 投票
4 回答
5313 浏览

cakephp - CakePHP 简单认证教程不起作用

我是 CakePHP 的新手。我正在尝试使用 CakePHP 2.4.1进行简单身份验证的 Cake 食谱教程。
尽管我输入了正确的用户名和密码,但我总是收到“无效的用户名或密码,请重试”。

根据AuthComponent API,如果参数 toAuth->login()为空或未指定,则请求将用于识别用户。调试查询输出显示

这是我的用户模型:

0 投票
1 回答
2327 浏览

php - CakePHP Themed application and plugin view elements missing

I use CakePHP 2.4.1 and after installing CakeDC comments plugin, I got the following Notice:

Notice (1024): Element Not Found: Elements\comments\flat\main.ctp [CORE\Cake\View\View.php, line 415]

My base application is using theme. I initialize theming from the AppController beforeFilter callback as follows:

To solve this issue I tried two methods, one of them succeeded but the other is not as follows:

  1. Creating \Plugin\Comments\View\Themed\Slate\Elements and then copying all the contents of \Plugin\Comments\View\Elements to the new directory. However, this solution does not work.
  2. Copying the \Plugin\Comments\View\Elements\comments directory to \app\View\Themed\Slate\Elements. This solution is working fine. This solution works also if I copied to \app\View\Elements.

I initialze the plugin from app/Config/bootstrap.php as follows:

And from the controller as:

The following is a screen shot of the notice: enter image description here

In addition when I try to access http://mywebsite.com/comments it returns error about Action CommentsController::index() could not be found. which is rendered in missy layout that mix my themed layout and the default CakePHP layout, the following shot demonstrates it:

enter image description here

In the CakePHP manual there is no any mention about copying view files of a plugin. It should work as it is! I don't know why the plugin missed its way to its elements?! How could I make this plugin interaction correctly with the theme view of the app?

0 投票
1 回答
1594 浏览

php - $this->params 在 cakephp 模型中返回 null

我决定在一些模型 beforeSave 中添加一些关于控制器和操作的额外数据,如下所示:

调试的打印输出返回null!我使用的模型是评论插件的评论模型。我需要访问参数以获取当前控制器、操作和一些 url 参数。

实际上,我计划将评论插件列出基于模型的评论的方式更改为基于路径的方式,以解决多个操作的评论需要依赖于同一模型的问题。

0 投票
0 回答
77 浏览

regex - 简单路线将不匹配

我看不出 CakePHP 中这条路线有什么问题。

http://www.example.com/board/app-max不会匹配。

这是我的路线

我最终得到一个BoardController未找到的错误。

http://www.example.com/board/app匹配成功。所以我的问题是何时key包含破折号。

编辑:我发现[A-Za-z0-9\-_]+效果很好,但[a-z\-]+没有。

设置详情

  • PHP 5.4.16
  • CakePHP 2.4.1
  • Windows 7的
  • Zend 社区服务器 6.1

.htaccess