如何追踪CakePHP的内部工作流程
简短描述
我现在正在习惯 CakePHP,并且想知道如何获取有关框架内发生的情况的更多调试信息。
请让我更详细地解释一下我的情况,
正如您所知,CakePHP 为您做了很多事情,而无需您编写额外的代码。一个例子是模型的处理。 我刚刚创建了一个模型用户并添加了验证规则(没有其他方法)。正如 API 中所描述的,像 save 这样的方法就可以工作。 之后,我创建了添加新用户所需的控制器和视图。当我尝试从视图添加用户时,我只收到闪现消息 无法创建用户。请重试。
不会出现验证违规。
我还将调试级别设置为 2: Configure::write('debug', 2);
但没有收到任何错误。 \tmp\logs 内的 error.log
也是空的。
我真的很想学习将来如何解决这些问题。
那么我还能做些什么来调试/显示蛋糕的内部流程?
非常感谢您的帮助!
Short description
I'm getting used to CakePHP right now and am wondering about how to get more debug-information about what is happening inside the framework.
Let me please explain my situation a little more detailed
As you know CakePHP does a lot for you without putting you into the need to write additional code. One example is the handling of models.
I just created a model User and added validation-rules (no other methods). As described in the API methods like save will just work.
After that I created the needed controller and view to add a new user. When I try to add a user from the view I just receive the flash-message The user could not be created. Please, try again.
No validation-violations are flashed.
I also did set the debug-level to 2: Configure::write('debug', 2);
but do not receive any errors. The error.log
inside \tmp\logs is also empty.
I really do want to learn how to solve those issues in the future.
So what else can I do to debug / display inner processes of cake?
Thank you very much for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
DebugKit 是一个官方插件,为您提供有关 Cake 生成的请求、查询和变量的大量信息:
https://github .com/cakephp/debug_kit
您还可以在调试器中使用
trace()
和其他方法来显示后台正在执行的内容:http://book.cakephp.org/2.0/en/development/debugging.html
DebugKit is an official plugin that gives you lots of information on the request, queries and variables produced by Cake:
https://github.com/cakephp/debug_kit
You can also use
trace()
and other methods in the Debugger to show what is being executed in the background:http://book.cakephp.org/2.0/en/development/debugging.html
使用带有集成调试器的 PHP IDE。这将允许您在执行时逐行跟踪执行,甚至在执行过程中检查变量值。 Netbeans 是一款免费软件。
Use a PHP IDE with an integrated debugger. That will allow you to follow execution line by line as it is executed and even inspect variable values as you go. Netbeans is a free one.