In the /app/
directory in Laravel 4, there is a file called server.php
. The contents of this file look like this:
<?php
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri = urldecode($uri);
$paths = require __DIR__.'/bootstrap/paths.php';
$requested = $paths['public'].$uri;
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' and file_exists($requested))
{
return false;
}
require_once $paths['public'].'/index.php';
似乎这个文件在某种程度上被用来模仿Apache的mod_rewrite
功能,但是我在Laravel documentation中找不到任何提到它或它的用途的东西.
I currently am trying to utilize Laravel on an IIS server that I do not manage. I do not have the ability to modify the URL rewrite module options on IIS (I will in the future), but would like to get started working with the framework now, if possible. This server.php
file seems like it may be a stop-gap solution to do just that.
如果server.php
文件的目的真的是为了模拟Apache的mod_rewrite
功能,那么有人能解释一下它的用途以及如何使用/激活它吗?