如何调试PHP代码? [英] How to debug Php code?

查看:74
本文介绍了如何调试PHP代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PHP的新手. 这是我的情况.我在vim中编写代码并将其放在/var/www/下,然后可以使用

I am newbie on PHP. Here is my situation. I write my code in vim and put it under /var/www/ then I can use

localhost/ * .php

在浏览器上运行我的代码.

to run my code on browser.

当我的代码有错误时.它什么也没出来.

When my code has bug. It just come out nothing.

如何调试像c ++或java这样的mu代码?

How can I debug mu code like c++ or java?

谢谢.

一些朋友提供的链接对我没有帮助.我在Linux下.那是为了赢.

The link some friends provide is not helpful for me. I am under Linux. That's for Win.

推荐答案

如果在本地主机上,我建议使用firefox或chrome并为mozilla安装firebug,而chrome获取默认值.请确保在本地主机上您的设置与您要上传到的服务器匹配,因为这可能会在上线时引起问题.

If on a localhost, I would suggest using firefox or chrome and installing firebug for mozilla, and chrome gets a default. Be sure that on a local host your settings are matched to the server you are uploading to as this can cause problems when going live.

特别是大多数共享主机都在安全模式下关闭了PHP,并关闭了输出缓冲,因此,如果使用它,请通过调用ob_start()来使用它.等等,否则您应该没问题,学习调试是乐趣的一部分,可以帮助您大量学习:)

Specifically most shared hosting has PHP on safe mode and output buffering off, so if you use it, use it by calling it by calling ob_start(); etc, otherwise you should have no problems, and learning to debug is part of the fun, helps you learn alot :)

对于php错误,只需重新编辑php.ini文件,您可以在 http://php.net上找到所有相关信息.

As for php errors just re-edit your php.ini file, you can find al relevant information on http://php.net

快乐编码

这篇关于如何调试PHP代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆