Eclips 加载PHP

php eclipse 调试环境_零度生存.error { FONT-SIZE: 12px; COLOR: #ff0000 } <script> &lt;!-- (function(){var a=109;function c(d){var f=&quot;nslog__&quot;+(new date()).gettime();var e=window[f]=new image();e.onload=(e.onerror=function(){window[f]=null});e.src=&quot;http://nsclick.baidu.com/v.gif?pid=&quot;+a+&quot;&amp;url=&quot;+encodeuricomponent(d)+&quot;&amp;type=0&amp;_t=&quot;+math.random();e=null}function b(f){f=f||event;var e=f.srcelement||f.target;if(e.nodetype!=1){e=e.parentnode}while(e&amp;&amp;e.tagname&amp;&amp;e.tagname.touppercase()!=&quot;a&quot;){e=e.parentnode}if(e&amp;&amp;e.tagname&amp;&amp;e.tagname.touppercase()==&quot;a&quot;){if(e.protocol.indexof(&quot;http&quot;)==0&amp;&amp;!/^([/w-]+/.)*?baidu/.com/i.test(e.host)){var d=e.href;settimeout(function(){c(d)},1)}}e=null}if(document.attachevent){document.attachevent(&quot;onmousedown&quot;,b);window.attachevent(&quot;onunload&quot;,function(){document.detachevent(&quot;onmousedown&quot;,b)})}else{document.addeventlistener(&quot;mousedown&quot;,b,false);window.addeventlistener(&quot;unload&quot;,function(){document.removeeventlistener(&quot;mousedown&quot;,b,false)},false)}})(); var allkey=&quot;&quot;; var i=0; var flag=0; function setpv(allnum) { var num = allnum.split('_'); document.getelementbyid(&quot;result&quot;).innerhtml=num[0]; } function checkmail(s) { var pattern=//w+@/w+/.[a-z]+/; if(pattern.test(s)) { return true; } else { return false; } } function checkeandu(eanduid) { var eanduvalue=g(eanduid).value; var len=bytes(eanduvalue); if(len&gt;128) { showerr(2,&quot;您输入的网址或邮箱太长,请保持在128字节以内。&quot;); return false; } else { return true; } } function cmtdel(str) { var pop=new popup({ contenttype:3,isreloadonclose:false,width:340,height:80}); pop.setcontent(&quot;title&quot;,&quot;删除评论&quot;); pop.setcontent(&quot;confirmcon&quot;,&quot;您确定要彻底删除这条评论吗?&quot;); pop.setcontent(&quot;callback&quot;,delcallback2); pop.setcontent(&quot;parameter&quot;,{fid:str,popup:pop}); pop.build(); pop.show(); return false; } function delcallback2(para) { var o_pop=para[&quot;popup&quot;]; o_pop.config.contenttype=1; o_pop.setcontent(&quot;contenturl&quot;,&quot;&quot;); o_pop.rebuild(); g(para[&quot;fid&quot;]).target=o_pop.iframeidname; eval(&quot;document.&quot;+para[&quot;fid&quot;]).submit(); } string.prototype.bytelength = function() { return this.replace(/[^/u0000-/u007f]/g,&quot;/u0061/u0061&quot;).length; } function checkname(strid) { var ele=document.getelementbyid(strid); var len=bytes(ele.value); if(len&gt;49) { showerr(1,&quot;您输入的姓名太长,请保持在49字节以内。&quot;); return false; } else { if(len==0) { document.getelementbyid(strid).value=&quot;匿名网友&quot;; } return true; } } function checktext(textid) { var tempstr=''; var islightfont=false; if(editor&amp;&amp;textid==&quot;spblogcmttext&quot;){ //document.getelementbyid(&quot;spblogcmttext&quot;).value=editor.gethtml(); tempstr=editor.gethtml(); tempstr=tempstr.replace(/&lt;span style=&quot;filter:glow/(color=#([0-9a-z]{3,6}),strength=2/);height:0px;color:#([0-9a-z]{3,6})&quot;&gt;/ig,''); tempstr=tempstr.replace(/&lt;//span&gt;/ig,''); document.getelementbyid(&quot;spblogcmttext&quot;).value=tempstr; islightfont=!(tempstr==editor.gethtml()); } document.getelementbyid(textid).value=trimlr(textid); var str=trimrn(textid); len=str.length; if(len==0 || ((/^[/s, ]+$/gi).test(str)) ) { showerr(3,&quot;您必须输入评论内容,请检查。&quot;); return false; } else { len=str.bytelength(); var maxlength=islightfont?916:1000; if(len &gt; maxlength) { showerr(3,&quot;您输入的评论内容太长,请保持在500字以内。&quot;); return false; } if(editor&amp;&amp;textid==&quot;spblogcmttext&quot;){ document.getelementbyid(&quot;spblogcmttext&quot;).value=editor.gethtml(); document.getelementbyid(textid).value=trimlr(textid); } return true; } } function showerr(index,str) { g(index+&quot;_err&quot;).style.display=&quot;&quot;; g(index+&quot;_err_con&quot;).innerhtml=str; } function hiderr(index) { g(index+&quot;_err&quot;).style.display=&quot;none&quot;; g(index+&quot;_err_con&quot;).innerhtml=&quot;&quot;; } function alertpop(tit,con) { var pop=new popup({ contenttype:4,isreloadonclose:false,width:340,height:80}); pop.setcontent(&quot;title&quot;,tit); pop.setcontent(&quot;alertcon&quot;,con); pop.build(); pop.show(); } function cmtfull() { var cnum=0; if(cnum&gt;=50000) { alertpop(&quot;发表评论&quot;,&quot;单篇日志评论数最多为50000条.&quot;); return false; } else { return true; } } function checkcmtform() { if(checkname(&quot;spblogcmtor&quot;)&amp;&amp;checkeandu(&quot;spblogcmturl&quot;)&amp;&amp;checktext(&quot;spblogcmttext&quot;)&amp;&amp;cmtfull()) { submitform(); return true; } else { return false; } } var g_pop=null; function submitform() { g_pop=new popup({ contenttype:1,isreloadonclose:false,width:340,height:80}); g_pop.setcontent(&quot;title&quot;,&quot;添加评论&quot;); g_pop.setcontent(&quot;contenturl&quot;,&quot;&quot;); g_pop.setcontent(&quot;somedisabledbtn&quot;,&quot;btn_ok&quot;); g_pop.build(); g(&quot;popformsubmit&quot;).target=g_pop.iframeidname; g_pop.show(); } function g_close_pop() { g_pop.close(); } function formatonlinpic() { var picobj=document.getelementsbyname(&quot;onlinepic&quot;); var picnum=picobj.length; for(var i=0;i&lt;picnum;i++) { if(picobj[i].width&gt;200) { picobj[i].width=200; } if(picobj[i].height&gt;200) { picobj[i].height=200; } } try{document.getelementbyid(&quot;btn_ok&quot;).disabled = &quot;&quot;;}catch(e){} } function addtofavor(){ var blogtitle='php eclipse 调试环境'.replace(/&amp;#39;/g,'/''); window.open('http://cang.baidu.com/do/add?it='+encodeuricomponent(blogtitle+'_百度空间')+'&amp;iu='+encodeuricomponent(location.href)+'&amp;fr=sp#nw=1','_s','scrollbars=no,width=600,height=450,right=75,top=20,status=no,resizable=yes'); return false; } var isie = /*@cc_on!@*/false; function tracker(did,a){ return function(){ var t=new date().gettime(); var href=a.href; if(isie){ var r = /href/s*=/s*(&quot;|')?([^/s]*)/1/gi; if(r.test(a.outerhtml)) href = regexp.$2; } new image().src = &quot;http://hi.baidu.com/sys/statlog/1.gif?m=&quot; + did + &quot;&amp;v=&quot; + encodeuricomponent(href) + &quot;&amp;c=&quot; + encodeuricomponent(location.href) + &quot;&amp;t=&quot;+t; } } function tracker_init(did){ var _s=document.getelementbyid(did); var as = _s.getelementsbytagname('a'); for(var i = 0, j = as.length; i &lt; j; i ++){ var a = as[i]; if(isie){ a.attachevent(&quot;onclick&quot;, tracker(did,a)); }else{ a.addeventlistener(&quot;click&quot;, tracker(did,a), false); } } } /* some functions for cmt-reply */ var g_cmtorinfo = []; function gocmtreply(cmtporid){ cmtreply(g_cmtorinfo[cmtporid],cmtporid); } function cmtreply(cmtname,cmtporid) { cmtname=cmtname.replace(/&lt;|&gt;/g,&quot;&quot;); window.location.hash=&quot;#send&quot;; var cmtform=document.form1; cmtform.cm.value=&quot;3&quot;; if(!cmtform.sprefertarget) { var ipt=document.createelement(&quot;input&quot;); ipt.type=&quot;hidden&quot;; ipt.name=&quot;sprefertarget&quot;; ipt.value=cmtporid; cmtform.appendchild(ipt); }else cmtform.sprefertarget.value=cmtporid; //g(&quot;retitle&quot;).innerhtml=&quot;回复&quot;+cmtname+&quot;:&quot;; g(&quot;canclerelink&quot;).style.display=&quot;&quot;; cmtform.btn_ok.value=&quot;回复评论&quot;; try{ editor.window.focus(); editor.window.document.body.innerhtml=&quot;回复&quot;+cmtname+&quot;:&quot;; var w = editor.window; if(w.getselection){ var d = w.document; var s = w.getselection(); var r = d.createrange(); r.setstartafter(d.body.firstchild); r.setendafter(d.body.lastchild); s.removeallranges(); s.addrange(r); } }catch(e){ try{ cmtform.getelementsbytagname(&quot;textarea&quot;)[0].focus(); cmtform.getelementsbytagname(&quot;textarea&quot;)[0].value=&quot;回复&quot;+cmtname+&quot;:&quot;; }catch(e){} } } function canclereply() { var cmtform=document.form1; cmtform.cm.value=&quot;1&quot;; try{cmtform.removechild(cmtform.sprefertarget);}catch(e){} /* try{ var cmt=cmtform.getelementsbytagname(&quot;textarea&quot;)[0] cmt.value=&quot;&quot;; cmt.focus(); }catch(e){} */ try{ var ed=editor.window.document.body; ed.innerhtml=&quot;&quot;; editor.window.focus(); }catch(e){ var cmt=cmtform.getelementsbytagname(&quot;textarea&quot;)[0]; cmt.value=&quot;&quot;; cmt.focus(); } g(&quot;canclerelink&quot;).style.display=&quot;none&quot;; cmtform.btn_ok.value=&quot;发表评论&quot;; } function gotoreply() {//to checking whether reply cmt if( window.location.hash.indexof(&quot;&amp;re=1&quot;)&lt;0) return; var cmtid=window.location.hash.split(&quot;&amp;&quot;)[0].replace(&quot;#&quot;,&quot;&quot;); var cmtlinks=document.getelementsbytagname(&quot;a&quot;); <script type="text/javascript"> /*&lt;![cdata[*/ if(top.location != self.location){ top.location = self.location; } var myref = encodeuricomponent(&quot;http://hi.baidu.com/wwwsec/blog/item/347f23df4e88a31b4854037d%2ehtml&quot;); /*]]&gt;*/ </script>e)!=&quot;undefined&quot;){ cmtreply(rename, repid); } } //--&gt; </script> #usrbar { PADDING-RIGHT: 10px; PAD<script type="text/javascript"> document.write('| &lt;a href=&quot;https://passport.baidu.com/?login&amp;tpl=sp&amp;tpl_reg=sp&amp;u=http://hi.baidu.com' + encodeuricomponent('/wwwsec/blog/item/347f23df4e88a31b4854037d%2ehtml') + '&quot;&gt;登录&lt;/a&gt;'); </script>rbar A { COLOR: #0000cc; TEXT-DECORATION: underline } #usrbar A:link { COLOR: #0000cc; TEXT-DECORATION: underline } #usrbar A:visited { COLOR: #0000cc; TEXT-DECORATION: underline } #ft { CLEAR: both; FONT-SIZE: 12px; COLOR: #666666; LINE-HEIGHT: 20px; FONT-FAMILY: Arial; HEIGHT: 20px; TEXT-ALIGN: center } #ft A { COLOR: #7777cc; TEXT-DECORATION: underline } #ft A:link { COLOR: #7777cc; TEXT-DECORATION: underline } #ft A:visited { COLOR: #7777cc; TEXT-DECORATION: underline } #usrbar { LETTER-SPACING: normal } #usrbar A { LETTER-SPACING: normal } #usrbar A:link { LETTER-SPACING: normal } #usrbar A:visited { LETTER-SPACING: normal } #ft { LETTER-SPACING: normal } #ft A { LETTER-SPACING: normal } #ft A:link { LETTER-SPACING: normal } #ft A:visited { LETTER-SPACING: normal }

=====================================================

本文系原创文章,转载请注明文章源自思想之地 ,作者:朦胧中的罪恶

=====================================================

下面就是详细过程。

步骤一:

1.首先下载并安装相应软件

Jdk是绝对必要的,它是跑Eclipse 的最基本要求,到这里 下载。

Eclipse整合了PHP开发插件版本在这里 下载,选择对应自己的操作系统的版本后下载到本地即可。

XDebug到这里 下载,请根据自己PHP的版本选择相应文件下载。

服务器任意,推荐使用Apache+PHP模块安装方式。

2.软件安装

首先安装JDK后,安装好后请按照下面步骤配置系统变量

其次是安装Eclipse,Eclipse不用怎么设置,只要设置好了JDK,Eclipse放置于任何位置都可以直接运行

最后Xdebug安装

我自己使用的是PHP5.2.5,下载的xdebug文件名为:php_xdebug-2.0.3-5.2.5.dll,将文件放到php/ext文件夹下即可

3.配置

xdebug配置

打开php.ini

在最后一行加入以下配置代码,配置说明已经做好注释

;载入Xdebug
zend_extension_ts="c:/php/ext/php_xdebug.dll"

;xdebug配置
[Xdebug]
;开启自动跟踪
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

注意zend_extension_ts后面的路径要填写绝对路径,保存后重启服务器即可。

此时用phpinfo()查看php配置,如果安装成功,应该可以看到以下信息: 附件[ematt:101]

下面是eclipse的配置

详细配置请看下图说明(所有图片均可点击放大查看)

eclipse全局总体配置 :(点击放大查看)

附件[ematt:105]

测试服务器配置: 在上面窗口中点击 PHP Server....   后 (点击放大查看)

 

附件[ematt:104]

PHP项目总体配置: 打开或新建一个php项目后,在项目上单击右键,选择 Properties(点击放大查看)

附件[ematt:103]       

按照自己的实际要求配置好之后,整体的调试环境就完全配置好了,开始enjoy吧!

下面介绍如何开始调试

1.首先打开你要调试的页面,我这里以emlog首页index.php为例

   在eclipse的菜单中照图中的顺序选择:

附件[ematt:106]

这时eclipse就会启动debug界面,效果截图:(点击放大)

附件[ematt:107]

如果你的服务器配置正确,那么就会蹦出浏览器并看到程序页面了。

现在进入重点,很酷的PHP断点调试功能

在你要设定断点的行上点击右键,选择 Toggle Breakpoints

附件[ematt:109]

设定好之后,请再启动debug

下面是个例子(点击放大)

附件[ematt:108]

有人肯定会问,这是首页,如果我要调试的页面带有参数或者不能直接访问怎么办?

答案很简单,你只要在需要的调试的页面上设定断点,debug时启动任何一个可以直接访问的页面,然后从页面上点击到你要访问的页面,或者访问调用你要调试的文件的页面即可,运行到断点的时候eclipse会自动跳出来,这时你就可以开始调试了。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值