gpt4 book ai didi

routing - 为什么 Silex 返回 "The requested URL/home was not found on this server."错误信息?

转载 作者:行者123 更新时间:2023-12-03 18:23:14 34 4
gpt4 key购买 nike

这是我第一次和 Silex 一起玩。我在 GET 和 POST 中尝试了“/”路由,一切正常。现在我正在尝试提出更复杂的请求:

<?php

require_once __DIR__ . '/../vendor/autoload.php';
$app = new Silex\Application();
$app->get(
'/home',
function () use ($app) {
return 'Homepage';
}
);
$app->run();

“/home”路由返回“在此服务器上找不到请求的 URL/home。”。为什么?

这是我的.htaccess:
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FIOLNAME} !-f
RewriteRule ^ index.php [L]

“/index.php/home”有效

最佳答案

试试 index.php/home .如果可行,您将缺少 .htaccess(在 Apache 上)。

看这里 http://silex.sensiolabs.org/doc/web_servers.html

关于routing - 为什么 Silex 返回 "The requested URL/home was not found on this server."错误信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19624777/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com