doumi1884 2015-06-23 19:39
浏览 22

需要/包含在PHP框架中

I just started refactoring my non-framework project into using Slim and Twig to try and make it follow a more modern design pattern.

I've come to the conclusion already, that for each route I have on my site, I will have to have a corresponding require with a matching path - or a require that has all possible paths in one (I don't know if there's a noticeable difference there aside from the logical separation of code).

It does not make sense in my head to include possibly (in my case) 80-100 routes and try and match them for every single request when the request could determine where we wanted to go in the first place - assuming we went away from the single-point-of-entry philosophy that Slim and so many other frameworks build upon. Is this how it's supposed to work or is there something I have misunderstood? I have read numerous tutorials on many different frameworks in attempt to find the right one for my project (which in itself was and still is a nightmare), and none of them seem to touch on the subject of "Hey - why are we doing this so inefficiently?"

Is the include/require operation simply so fast that we should not care, and we just sacrifice this for manageability? Excuse my ignorance, but when coming from a project where I only type require/include when I actually need something, this seems, well, stupid. I should mention that that development style has turned my project into chaos, which is why I've ended up here with Slim in the first place.

I just want to understand if I'm doing it right.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)
    • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。