测试环境: C:\阿帕奇 C:\ PHP
两个文件: C:\ apache的\ htdocs中\问候\网络\的index.php C:\阿帕奇\ htdocs中\问候\应用\ app.php
http://localhost/greeting/web/index.php显示“默认页面”
http://localhost/greeting/web/hello显示“Not Found,在此服务器上找不到请求的URL / greeting / web / hello。”
index.php内容:
<?php
$website = require_once __DIR__.'/../app/app.php';
$website->run();
?>
app.php内容:
<?php
require_once __DIR__."/../vendor/autoload.php";
$app = new Silex\Application();
$app->get("/", function() {
return "Default page";
});
$app->get("/hello", function() {
return "Hello page!";
});
$app->get("/goodbye", function() {
return "Goodbye page!";
});
return $app;
?>
我在这里缺少什么?任何帮助都会帮助这个沮丧的初学者。
干杯, 艾登
答案 0 :(得分:1)
你没有提到任何服务器配置,所以我猜你忘了配置 .htaccess :
<script type="text/javascript">
function checkForm(theForm) {
"use strict";
/*global alert*/
var formValid = true,
elementCount = 0;
while (elementCount <= theForm.length) {
if (theForm.elements[elementCount].type === "text") {
if (theForm.elements[elementCount].value() === "") {
alert("Please complete all the form elements");
theForm.elements[elementCount].focus;
formValid = false;
break;
}
}
return formValid;
}
} </script>
如果您使用的是Apache之外的其他服务器,或者您想要更多解释,可以查看Silex Webserver Configuration Documentation以获取更多信息。