Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I run a zf2 application in localhost/zf2 locally. I want to retrieve the application base URL(for example http://localhost/) in my model.
localhost/zf2
http://localhost/
How can I get the localhost part of URL in model?
localhost
Or, how I recognize the project is online or offline?
MVC 架构是错误的。如果您想在模型中使用 baseUrl,请将 baseUrl 从控制器传递给模型。
但是当我使用 ZF1 时,我还添加了一个问题。有时它会对你有用。
获取模型中的基本 url