V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
赤友DiskGeeker — 一键搞定磁盘清理
赤友 DiskGeeker 专为 Mac 打造,支持一键清理系统垃圾,结合 AI 深度清理与智能分析技术,精准识别“其它文件”等磁盘占用,清理过程安全、可控、无风险。
Promoted by editorsiboysoft
yakczh
V2EX  ›  PHP

slim 里面 get/post 请求分开处理有什么好处?

  •  
  •   yakczh · 2015-07-01 14:14:37 +08:00 · 2576 次点击
    这是一个创建于 3674 天前的主题,其中的信息可能已经有所发展或是发生改变。

    比如

    $app->get('/hello/:name', function ($name) {
    echo "Hello, $name";
    });

    $app->post('/hello/:name', function ($name) {
    echo "Hello, $name";
    });

    相比传统的 class xxController {

    function xxxAction($name){
        echo "hello".$name
      }
    

    }
    有什么好处吗?

    ywisax
        1
    ywisax  
       2015-07-01 16:15:27 +08:00
    可以提高灵活度。
    如果不想这样折腾,那就用map(.........)->via('GET', 'POST')来做吧
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5500 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 03:23 · PVG 11:23 · LAX 20:23 · JFK 23:23
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.