工欲善其事必先利其器,要想写好好的程序,不光要有好的思想,好的编程习惯,也要有一个好的开发利器
eclipse不能不说是一个强大的IDE。
对于不同的开发人员,有不同的版本,我们可以下载eclipse for php
这里已集成了pdt的配置。
我们只要下载最新的xdebug就行了,去http://xdebug.com上下载最新的dll文件
放到和php.ini同一个目录中(也可以放到别的目录下)
在php.ini文件中加入
[Xdebug]
xdebug.default_enable = On
xdebug.collect_params = 4
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.auto_trace = On
xdebug.show_exception_trace = On
xdebug.remote_autostart = On
xdebug.remote_enable = On
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = On
xdebug.var_display_max_depth = 10
xdebug.remote_req = req
xdebug.profiler_enable = 0
zend_extension="D:\wamp\bin\php\php5.3.0\php_xdebug.dll" //这里我指定了绝对路径你可以改之
在eclipse里的window---preferences---php---debug下新建一个php executables
php debugger里选择xdebug,Encoding Settings 建议选择utf8
Break at first line 如果去掉的话则不会在第一行就将程序断掉,等待你按下F5或者F6继续
至此设置结束,打开你的程序,按下F11。再进行F5或者F6就能调试了,是不是很爽啊
最喜欢的就能这种能断点能查看变量值的调试方式了