http://docs.slimframework.com/ 下载地址这个东西很不错,照到官方的例子做
<?php require 'vendor/autoload.php'; $app = new \Slim\Slim();
$app->get('/hello/:name', function ($name) {
echo "Hello, $name";
});
$app->run();
访问localhost/index.php/hello/adaaa 怎么都报404错误
后面想了一下,要支持伪静态.
Nginx 设置是
root /Users/jackluo/Works/php/rest; location / {
root /Users/jackluo/Works/php/rest;
index index.html index.php;
try_files $uri $uri/ /index.php?$args;
}
Apache 设置是
【1】启动mod_rewrite——去掉#,#代表注释
LoadModule rewrite_module modules/mod_rewrite.so 【2】修改AllowOverride None为AllowOverride All
#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride All
Require all granted
</Directory>
这样再访问:
就有值了