如题,我使用 Wamp 版本为:
Apache Version :2.4.9
PHP Version :5.5.12
MySQL Version :5.6.17
目前状况是php码不会被执行,browser直接跑出部分原始码,html部分正常。
已尝试:
-开启apache;把skype port 80 选项关闭
-修改httpd.conf:
1. AllowOverride none 改为 All
2. PHPIniDir c:/wamp/bin/php/php5.5.12 确认路径档案无误
3. #LoadModule php5_module "c:/wamp/bin/php/php5.5.12/php5apache2_4.dll"
最前面#号拿掉
4. 有下面这两行:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
是否为source code哪边有问题呢??
请参考下面 travellers.html 和 travellers.php 两个档:
(在同一个资料夹下)
感谢指教~~!!
===================================================================
其中travellers.html 表单部分设定为
<form method="POST" action="travellers.php">
...
</form>
===================================================================
而travellers.php 详细原始码如下:
<!doctype html>
<html>
<head>
<title>Response of travellers Report</title>
</head>
<body>
<h2>You have reported successfully!!</h2>
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$place = $_POST['place'];
$budget = $_POST['budget'];
$exp = $_POST['exp'];
$to = 'xxxxxxxx@gmail.com';
$subject = "Response of $name 's Report";
$msg = "Your name is : $name.\n" .
"E-mail address : $email\n" .
"Place : $place\n" .
"Budget: $budget\n" .
"First trip ? $exp";
mail($to, $subject, $msg, 'From:' . $email);
echo 'Thanks for your response.<br />';
echo 'Your name is ' . $name . '<br />';
echo 'Your e-mail is ' . $email . '<br />';
echo 'Your travelling place is ' . $place . '<br />';
echo 'Your budget is ' . $budget . '<br />';
echo 'First time for travelling abroad?' . $exp '<br />';
?>
</body>
</html>
====================================================================
再次感谢~~!! :))))