I’m trying to test Slim on my Mac under XAMPP or native Apache Server from MAC OS, but under anyone works. Follow the code:
<?
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->get('/', function () {
echo '<h1>Sample test!!!</h1>';
});
// POST route
$app->post('/post', function () {
echo 'This is a POST route';
});
// PUT route
$app->put('/put', function () {
echo 'This is a PUT route';
});
// DELETE route
$app->delete('/delete', function () {
echo 'This is a DELETE route';
});
$app->run();
?>
Look at GET function callback just prints H1 text.
My .htaccess content:
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
I didn’t change anything in original files that I got at Slim website and keep showing 404 error on browser!
Could somebody help me?!
I was usign a 5.2.x version instead of 5.3.x!