I often see websites with URLs like domain.com/index.php/directory
. How does it work? It looks like there is a directory in a file.
I want to do the same on my own website. Sample code is appreciated.
I think it has more to do with filesystems and less with PHP. A directory can be named index.php
or any other thing with a dot.
You could just create a folder named 'index.php' to achieve the same result, but I think what you are referring to is sites using Model-View-Controller (mvc) framework type.
I am not very familiar with the concept, but basically the file called is index.php and the following "directories" are in fact parameters passed to the script.
Maybe this could help: How to do MVC form url formatting?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.