Eclipse下使用php需要安装PDT和Zend
通过help--install new software,点available software sites,然后找到PDT2.2或者pdt2.0或者在eclipse的3.5版里的ganlileo里有pdt2.1.1,
自动安装好后,写一个简单的php,如果出现下列问题,请安装zend插件
Error:
Can’t find any defined php executables
Analyze:
Although the all-in-one package is installed, the zend debugger is not included.
Solution:
Go to help->Software Update->add site ->type in http://downloads.zend.com/pdt
->check Zend debugger feature->install the extention.
http://www.hui-wang.info/2009/05/the-current-debugger-does-not-have-any-defined-php-executables/
装完后 run as server并看不到东西,因为你没有server,后来我找到了一个wampserver是php+apache+mysql的工具,非常方便,安装后做一点配置即可。主要是点apache,alias,然后写一个名字比如hi,然后输入hi要映射的目录“D:/eclipse/workspace”,这样你再在eclipse上开发项目时比如:项目PHPTest2(“D:/eclipse/workspace”的一级子目录),下有一个文件hi.html和welcom.php。
hello.html
<html>
<body>
<form action="welcom.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
welcom.php
<html>
<body>
Welcome <?php echo $_POST["name"]; ?>.<br />
You are <?php echo $_POST["age"]; ?> years old.
Welcome <?php echo $_REQUEST["name"]; ?>.<br />
You are <?php echo $_REQUEST["age"]; ?> years old!
</body>
</html>
在浏览器里输入http://localhost/hi/hello.html,即可看到你想看到的东西。