Slim端点与php'一起工作;s自己的服务器,但不是nginx
我制作了一个非常基本的slim应用程序,只有一个基本的hello world GET端点Slim端点与php'一起工作;s自己的服务器,但不是nginx,php,nginx,slim,restful-url,Php,Nginx,Slim,Restful Url,我制作了一个非常基本的slim应用程序,只有一个基本的hello world GET端点 <?php require 'vendor/autoload.php'; $app = new Slim\App(); $app->get('/hello/{name}', function ($request, $response, $args) { $response->write("Hello, " . $args['name']); return $respo
<?php
require 'vendor/autoload.php';
$app = new Slim\App();
$app->get('/hello/{name}', function ($request, $response, $args) {
$response->write("Hello, " . $args['name']);
return $response;
});
$app->run();
我哪里出错了?您需要修改您的
nginx\u vhost
文件,以便根据需要将参数传递给Slim
摘自他们的:
server {
listen 80;
server_name localhost;
root /var/www/;
index index.php index.html;
# Important for VirtualBox
sendfile off;
location / {
try_files $uri $uri/ =404;
}
location ~* \.php {
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_cache off;
fastcgi_index index.php;
}
}
server {
#.....
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
#....
}