php – 抱歉,找不到您要查找的页面. silex错误
发布时间:2020-05-25 08:56:30 所属栏目:PHP 来源:互联网
导读:我的.htaccess: IfModule mod_rewrite.cOptions -MultiViewsRewriteEngine OnRewriteBase /silex/webRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [QSA,L]/IfModule index.php文件: ?phpini
|
我的.htaccess: <IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /silex/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
index.php文件: <?php
ini_set('display_errors',1);
require_once __DIR__.'../vendor/autoload.php';
$app = new SilexApplication();
$app->get('/hello/{name}',function ($name) use ($app) {
return 'Hello '.$app->escape($name);
});
$app->run();
访问localhost / silex / hello / world时出现此错误: “抱歉,找不到您要查找的页面.” 为什么? 在.htaccess中试试这个<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /silex/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$index.php?$1 [QSA,L]
</IfModule>
文件的位置应该是: /silex/.htaccess /silex/web/index.php (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
