开发者

php mvc site resource path problems

开发者 https://www.devze.com 2023-02-06 19:28 出处:网络
I am building php mvc site and for routing I use regex matching. But I have problem when url route is (for example /news/1) more then one slashes after app root. Then all reqources are mising on rend

I am building php mvc site and for routing I use regex matching.

But I have problem when url route is (for example /news/1) more then one slashes after app root. Then all reqources are mising on rendered page (css, js and images)

I have found out that relative paths are problem, I have tried absolute paths using apache super globals DOCUMENT_ROOT but it still does not work.

The page that is rendered deeper in url (has more slashes 开发者_如何学JAVA) simply does not see resources.

What would be soultion?

Thanks a lot.


You can create some global variable / configuration singleton class, which will store "base URL" of your web site. After that you will be able to build all passes to all static resources from that path.

0

精彩评论

暂无评论...
验证码 换一张
取 消