http://docs.slimframework.com/ 下載地址這個東西很不錯,照到官方的例子作php
<?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錯誤html
後面想了一下,要支持僞靜態.web
Nginx 設置是app
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 設置是ide
【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>
這樣再訪問:ui
就有值了spa