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>
這樣再訪問:
就有值了
