PHP中的Flight Framework路由

I'm pretty new to PHP and especially Flight Framework. Therefore, I have a pretty basic question. What if our Flight folder is not in http://localhost/REST but in http://localhost/REST/AnotherFolder? How do we write URLs in index.php, for example Flight::route('/', function() { echo 'hello world'}); How do we write URL instead of /? And do we write require 'flight/Flight.php' or we put AnotherFolder/flight/Flight.php?

So, I assume your Flight installation is in the webroot in the subdirectory REST/AnotherFolder/flight

In your index.php you obviously need to require the file where it is and not in some other directory, so your require would looke like:

require 'REST/AnotherFolder/flight/Flight.php';

This also assumes that your index.php file is in the webroot folder and not in the REST folder, If not you have to change accordingly. This is just some basic understanding of how to require a simple file within a directory, plain simple, if not you have some basic grounds to cover.

The .htaccess that should be in same folder as your index.php (front controller) could look like:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

In your index.php (following the instructions like provided in the Flight doc http://flightphp.com/install)

Flight::route('/', function(){
    echo 'hello world!';
});

Now this route would point to localhost/index.php, if that's where the index.php file is located.

});