vicnicLight007
V2EX  ›  PHP

关于 tp5 的路由问题

  •  
  •   vicnicLight007 · Jan 23, 2020 · 5157 views
    This topic created in 2477 days ago, the information mentioned may be changed or developed.

    用的 tp5.1, Route::rule('sidebar', 'api/index/index', 'get'); 我的路径写 http://127.0.0.1/liboom/public/sidebar 就能请求成功拿到 json 数据 但是写 http://127.0.0.1/liboom/public/api/index/index 就报模块不存在:index 请问大佬们这是为啥

    3 replies  •  2020-01-24 11:13:21 +08:00
    jss
    jss
    Jan 23, 2020 via iPhone❤️2
    1
    路由有几种模式,前者是强路由模式,强路由模式下普通模式或自动识别抛异常
    vicnicLight007
    vicnicLight007
    OP
    Jan 24, 2020 via iPhone
    2
    @jss 谢谢大佬
    MiMiGe
    MiMiGe
    Jan 24, 2020❤️1
    3
    因为你定义过了路由,原来的访问地址会自动失效
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4944 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 07:15 · PVG 15:15 · LAX 23:15 · JFK 02:15
    ♥ Do have faith in what you're doing.