按照本教程:http: //johnsquibb.com/tutorials/mvc-framework-in-1-hour-part-one
我有以下代码:
索引.php
<?php
// Define document paths
define('SERVER_ROOT', '/Applications/MAMP/Library');
define('SITE_ROOT', '/Applications/MAMP/htdocs')
// Fetch the router
require_once(SERVER_ROOT . '/controllers/' . 'router.php');
路由器.php
<?php
//fetch the passed request
$request = $_SERVER['QUERY_STRING'];
//parse the page request and other GET variables
$parsed = explode( '&' , $request);
//the page is the first element
$page = array_shift($parsed);
//the rest of teh array are get stateemnts, parse them out.
$getVars = array();
foreach ($parsed as $argument)
{
//split GET vars along '=' symbol to separate variable, values
list($variable, $value) = split('=' , $argument);
$getVars[$variable] = $value;
}
//this is a test, and we will be removing it later
print "the page you requested is '$page'";
print '<br/>';
$vars = print_r($getVars, TRUE);
print "The following GET Vards we passed to the page:<pre>".$vars."</pre>";
打入这个网址:
http://localhost/MVC_test/index.php?news&article=howtobuildaframework
我收到此错误:
HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.
我的 MAMP 主页显示我的文档根目录是:/Applications/MAMP/htdocs
而我的服务器根目录是:/Applications/MAMP/Library
最后,索引文件的路径是:/Applications/MAMP/htdocs/MVC_test/index.php
我究竟做错了什么?