复制手册demo为什么路由不生效?

aizuotu

问题描述

官方demo 复制过来的,访问:http://127.0.0.1:8787/test/
未如期返回 test
不知道是什么原因?

<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

use Webman\Route;

Route::any('/test', function ($request) {
    return response('test');
});

报错信息

404

操作系统及workerman/webman等框架组件具体版本

linux

269 3 0
3个回答

whoami

人不行

  • aizuotu 2023-12-18

    已解决 不要以守护模式启动

TM

Route::group('/collect', function () use ($TOOL_MID) {
Route::group('/collect', function () {
Route::any('/addCollectForm', [\App\toolManage\controller\collect\CollectController::class, 'addCollectForm']);//提交表单
})->middleware($TOOL_MID);
})->middleware($TOOL_MID);

直接用any格式设置好用点

  • 暂无评论
Noah

/test/
/test
这是两个不同的url。

  • 暂无评论
🔝