php环境配置及调试配置的方法
php环境配置及调试配置的方法
今日打算学习PHP,工具还是使用我熟悉的eclipse。为了php环境的配置和调试配置,我花了很大功夫研究哈,以下是整理出来的方法:
1.安装和配置PDT
下载PDT: download.eclipse.org/tools/pdt/downloads/index.php, 选择最新版本
PDT是Eclipse的插件。
选择pdt-all-in-one版本, 否则需要另外下载eclipse和相关插件, 并手工集成.
2.安装debug环境
由于我用的是最新的xampp1.7.2,试了二天xdebug,出现如下如题:waiting for xdebug session,停止的了57%的进度上,程序无法调试。可能是xdebug和php5.3之间的问题。因此决定改用旧版xampp1.6.8,php的版本是5.2.6。结果还是出现了以上问题,让我不得其解,不得以,换成zend debugger。
xampp版本为1.6.8,从这里下载zend debugger 5.2.x。将文件解压后复制到\xampp\php\ext目录。
打开\xampp\apache\bin目录下的php.ini。的最后添加:
zend_extension_ts = "c:\xampp\php\ext\ZendDebugger.dll"
zend_debugger.allow_hosts=127.0.0.1/10,192.168.88.146
zend_debugger.expose_remotely=always
其中192.168.88.146是你机子上的IP地址。
3.设置PDT下的debug环境
启动Eclipse,将code目录设置为"xampp\htdocs",这样代码直接放到apache的WEB目录下
从主菜单打开"Window > Preferences > PHP",
先选中"PHP Excutables"节点,在右面的面板点"Add"按钮,在接下来的窗口中,
选中"Debug"节点,在右面的面板中,
"PHP Debugger"选择XDebug,
"Server"不用变
"PHP Executable"也选择你刚刚添加的那个"xampp-zend"
在PHP Debug透视图中可以点击Debug View中的图标或用快捷键来进行单步跟踪,比如:
F5: 单步跳入(可以跳入require()函数来跟踪到别的PHP文件哟)
F6: 单步跳过
F7: 单步跳出(可以从被require()的文件内跳回调用者哟)
F8: 继续执行(直到遇到下一个断点)
Ctrl+R: 执行到光标所在行(除非遇到断点)

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Best practices for writing JavaScript code in VSCode include: 1) Install Prettier, ESLint, and JavaScript (ES6) codesnippets extensions, 2) Configure launch.json files for debugging, and 3) Use modern JavaScript features and optimization loops to improve performance. With these settings and tricks, you can develop JavaScript code more efficiently in VSCode.

Efficient hashing strings in PHP can use the following methods: 1. Use the md5 function for fast hashing, but is not suitable for password storage. 2. Use the sha256 function to improve security. 3. Use the password_hash function to process passwords to provide the highest security and convenience.

How to view Git history and changes in VSCode include: 1. Open VSCode and make sure the project has initialized the Git repository. 2. Click the "Source Code Management" icon in the left sidebar. 3. Select "...(more options)" and click "Git:ShowGitOutput". 4. View commit history and file changes. 5. Right-click the file and select "Git:ShowFileHistory" to view the file change history. Through these steps, you can efficiently view Git history and changes in VSCode to improve development efficiency.

What is encryption jump? How is encryption rush to take shape? How to avoid encryption jumping? The crypto field is a rush to make profits by unconfirmed transactions, leveraging the transparency of blockchain. Learn how traders, bots, and validators manipulate transaction sorting, their impact on decentralized finance, and possible ways to protect transactions. Below, the editor of Script Home will give you a detailed introduction to encryption and rush forward! What is the rush to the encryption field? Taking the lead has long been a problem in the financial market. It originated in the traditional financial field, and refers to brokers or insiders using privileged information to trade before clients. Such behavior is considered immoral and illegal, and the regulator will investigate and punish it.

In PHP, goto statements are used to unconditionally jump to specific tags in the program. 1) It can simplify the processing of complex nested loops or conditional statements, but 2) Using goto may make the code difficult to understand and maintain, and 3) It is recommended to give priority to the use of structured control statements. Overall, goto should be used with caution and best practices are followed to ensure the readability and maintainability of the code.

The __clone method in PHP is used to perform custom operations when object cloning. When cloning an object using the clone keyword, if the object has a __clone method, the method will be automatically called, allowing customized processing during the cloning process, such as resetting the reference type attribute to ensure the independence of the cloned object.

Handling Git commit conflicts in VSCode can be effectively resolved through the following steps: 1. Identify the conflicting file, and VSCode will be highlighted in red. 2. Manually edit the code between conflict marks and decide to retain, delete or merge. 3. Keep branches small and focused to reduce conflicts. 4. Use GitLens extension to understand code history. 5. Use VSCode to build-in Git commands, such as gitmerge--abort or gitreset--hard. 6. Avoid relying on automatic merge tools and carefully check the merge results. 7. Delete all conflict marks to avoid compilation errors. With these methods and tricks, you can handle Git conflicts efficiently in VSCode.

In VSCode, you can use Git for code version fallback. 1. Use gitreset--hardHEAD~1 to fall back to the previous version. 2. Use gitreset--hard to fall back to a specific commit. 3. Use gitrevert to safely fall back without changing history.
