Composer php can';t使用localhost访问slim主页

Composer php can';t使用localhost访问slim主页,composer-php,slim,Composer Php,Slim,我已经安装了composer.php,然后运行php composer.phar require slim/slim“^3.0”命令,接下来我想访问myslimsite,但它无法打开。localhost/myslimsite没有运行只需安装: 或者,您也可以尝试此操作。您可以尝试启动,而不是在本地Web服务器上运行它 php -S localhost:8888 -t public public/index.php 在slimframework主目录中 然后,您将能够从访问您的Web服务 htt

我已经安装了composer.php,然后运行
php composer.phar require slim/slim“^3.0”
命令,接下来我想访问myslimsite,但它无法打开。localhost/myslimsite没有运行

只需安装:


或者,您也可以尝试此操作。

您可以尝试启动,而不是在本地Web服务器上运行它

php -S localhost:8888 -t public public/index.php
在slimframework主目录中

然后,您将能够从访问您的Web服务

http://localhost:8888

如果要使用本地Web服务器,需要2个htaccess文件:

第一个放入slim目录中,内容如下:

<IfModule mod_rewrite.c>
   RewriteEngine on
   RewriteRule ^$ public/     [L]
   RewriteRule (.*) public/$1 [L]
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

希望有帮助。

您是否设置了Web服务器并设置了文档根目录?是的。做了一切
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]