dpbf62565 2019-08-02 14:09
浏览 82

使用.htaccess将URL映射到被认为是不良做法的处理程序?

I was wondering why every framework is using there own http routing and not using for example apaches mod_rewrite.

In frameworks like larave, symfony etc. there redirect every request to index.php and routing happens using php.

$app->get('/foo/:id', 'FooController@fooMethod');

Why is that? You could use apaches mod_rewrite to do the same thing and probably would be faster than using a php router.

RewriteRule ^/foo/(\d+)$ index.php?action=FooController@fooMethod&id=$1

What are the pros and cons using a own php router? Is using standard mod_rewrite for routing considerd bad practice?

  • 写回答

1条回答 默认 最新

  • drxrgundk062317205 2019-08-02 14:13
    关注

    I think this is a better practice beacuse it's much cleaner to see what's going on, also you have no limits in creativity how it should work, you can customize whatever you want.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错