路由代碼
use Webman\Route;
Route::any('/open/base/wechat/appid/{name}', [app\open\controller\Base::class, 'testurl']);
控制器代碼
namespace app\open\controller;
use support\Request;
use think\facade\Db;
use EasyWeChat\Factory;
use EasyWeChat\OpenPlatform\Server\Guard;
use Symfony\Component\HttpFoundation\HeaderBag;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
class Base
{
public function testurl(){
return response('我要看看');
}
訪問 http://127.0.0.1:8787/open/base/wechat/appid/wx555555
頁(yè)面顯示404 看樣子路由沒有生效, 不用類路由,使用閉包路由是ok的
是因?yàn)槟夸浱畹膯栴}嗎? 大佬幫忙看看 感謝
已經(jīng)解決,是命名空間和物理路徑不一致導(dǎo)致,
在不用路由下沒什么問題,
用了路由會(huì)導(dǎo)致404,所以需要遵守規(guī)范,統(tǒng)一命名空間和文件物理路徑