PHP 无法与 Expression Web 3 一起使用
我开始尝试在使用 Expression Web 3 的同时学习 PHP。我设置了 PHP 运行时并配置了 ini。发生的情况是我的脚本没有按预期执行。
我的页面如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<title>Sports</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="master.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
</head>
<body>
<div id="masthead">
</div>
<div id="top_nav">
<ul>
<li>Sports </li>
<li>Clubs</li>
<li><a href="default.html">Cloud</a></li>
</ul>
</div>
<div id="container">
<div id="left_col">
</div>
<div id="page_content">
</div>
</div>
<div id="footer">
<form method="post">
</form>
</div>
<form action="action.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>Your age: <input type="text" name="age" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
然后我的 PHP 文件如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>action</title>
</head>
<body>
Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.
</body>
</html>
应该发生的情况是,例如,如果我输入 John 作为姓名,50 作为年龄,它应该输出 Hi John, you are 50 岁。 但它却说(对于 Firefox): 你好,你几岁了 在 Internet Explorer 8 中,它只输出整个 php 脚本。 我不确定我哪里错了。
谢谢
I'm starting to try to learn PHP while using Expression Web 3. I set up PHP runtime and configured the ini. What happens is my script doesn't do as it should.
My page looks like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="en-us" http-equiv="Content-Language" />
<title>Sports</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="master.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
</head>
<body>
<div id="masthead">
</div>
<div id="top_nav">
<ul>
<li>Sports </li>
<li>Clubs</li>
<li><a href="default.html">Cloud</a></li>
</ul>
</div>
<div id="container">
<div id="left_col">
</div>
<div id="page_content">
</div>
</div>
<div id="footer">
<form method="post">
</form>
</div>
<form action="action.php" method="post">
<p>Your name: <input type="text" name="name" /></p>
<p>Your age: <input type="text" name="age" /></p>
<p><input type="submit" /></p>
</form>
</body>
</html>
Then my PHP file looks like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>action</title>
</head>
<body>
Hi <?php echo htmlspecialchars($_POST['name']); ?>.
You are <?php echo (int)$_POST['age']; ?> years old.
</body>
</html>
What should happen is for example if I type John as name and 50 as age, it should output Hi John, you are 50 years old.
But instead it says (with Firefox) :
Hi you are years old
in Internet Explorer 8, it just outputs the whole php script.
I'm not sure where I went wrong.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有从启用 PHP 的 Web 服务器运行这些文件,或者 Web 服务器未配置为将使用的文件扩展名作为 PHP 提供服务。如何安装和配置网络服务器最好在 ServerFault.com 上询问。查看 XAMP 或 Zend Server CE。
Either you are not running these files from a PHP enabled webserver or the webserver is not configured to serve the used file extension as PHP. How to install and configure a webserver is best asked on ServerFault.com. Have a look at XAMP or Zend Server CE.