调试magento程序的方法

本文介绍了提高工作效率的两种方法,一是遵循编码规范和最佳实践来减少错误,二是掌握Magento的调试技术。文中列举了多种调试手段,如使用Eclipse调试器、Bug commerce、Mage::log、Varien Object、回溯跟踪、远程服务器级调试以及var_dump等,并推荐了phpStorm结合magicento插件以及MagentoDebugger Chrome App作为强大的开发和调试工具。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

为了工作,不得不掌握debug的方法。因为我是一个很挫的程序员,写的代码质量可想而知。如果弄出很多问题来,则我工作的主要任务就是解决各种bug,轻轻松松挖坑,然后花大部分工作时间埋坑。

因此,我觉得可以从两个方面来提高我的工作效率:

一、从源头上减少出错

严格遵循相关的编码规范,多思考逻辑,遵循最佳实践。此外,使用标准的开发流程和工具也能避免引入低级错误。

二、掌握调试方法

快速定位问题,减少问题解决的时间。


下面我直接把stackoverflow网站上的几个人的方法摘录下来。我就按照这个去debug就好。

—— By Satish Mantri

Here is a compiled list My company Uses.

  1. Use of Eclipse debugger: Magento is installed on a desktop using Eclipse debugger we apply breakpoints and other debugging tricks.

  2. Use of Bug commerce as suggested in above post.

  3. Use of Mage::log for error log and exception log.Also Magento Report files.

  4. Use of Varien Object getData, debug.

  5. Use of back trace: Mage::log(Varien_Debug::backtrace(true, true), null, 'backtrace.log')

  6. Remote server level debugging.

  7. var_dump PHP function to echo and exit.

—— By GrinGo

If you are (want to be) a real Magento Developer, here is the best combination of IDE and plugin you must use to work on your Magento Projects.

  1. First of all, phpStorm the best IDE you can find.
  2. Exist a very helpful plugin called magicento that you can use auto-complete, find in path magento, create modules very quickly and without issue, other great stuff you can use with that plugin.
  3. Of course need to install Xdebug (be carefully if you already run a project with ioncube, bc you need to make some trick there, Xdebug doens't work properly with ioncube loader).
  4. This last item on the list is something I need to be reviewing but I think should be great to debugging porpoises, MagentoDebugger Chrome App.




附录:

原文:

http://stackoverflow.com/questions/7474245/how-to-debug-magento-application

https://www.sonassi.com/knowledge-base/magento-debug-process/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值