Step 1: Install XAMPP
XAMPP 是一个集成了 Apache 服务器、MySQL 数据库和 PHP 的开放源代码软件包。
Step 3: Configure the Apache
打开Apache的配置文件httpd.conf,有效化 Apache Rewrite (mod_rewrite) 模块。
Step 4: Install Composer
下载 Composer并安装。
Step 5: Install Slim
创建Slim项目。
Composer create-project slim/slim-skeleton [my-app-name]
Step 6: Install a PSR-7 Implementation and ServerRequest Creator
安装基础标准规范。
composer require slim/psr7
Step 7: Create .htaccess File
打开Apache的配置文件httpd.conf,有效化 Apache Rewrite (mod_rewrite) 模块。
Step 8: Hello World
File: public/index.php
<?php use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory; require __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); $app->get('/', function (Request $request, Response $response, $args) { $response->getBody()->write("Hello world!"); return $response; }); $app->run();
Step 9: Start Slim Application
安装基础标准规范。
标签:Composer,slim,Step,Install,Apache,PHP,response From: https://www.cnblogs.com/sekihin/p/18614281