我有这样的API路径
http://localhost/myProject/public/delivery/324
因此,每当我使用{projectPath} / delivery或{projectPath} / delivery / {id}来访问API时,API都会像在htaccess中那样编写RewriteRule时对ping / public / delivery / index.php进行ping操作
RewriteRule ^delivery/(.*)$ delivery/index.php [QSA,NC,L]
我的delivery / index.php包含以下实际的瘦路径,
<?php
$app = new \Slim\App(["settings" => $config]);
$app->group("/delivery", function(){
$this->post("", "MyController:createDelivery");
$this->get("/{id}", "MyController:getDeliveryId");
});
$app->run();
控件即将交付/index.php。但是,纤细的路由不起作用,并且无法ping MyController
。我在这里想念什么吗?
答案 0 :(得分:0)
根据Pipe评论,我的工作如下,
$app->post("/", "MyController:createDelivery");
$app->get("/{id}", "MyController:getDeliveryId");