开发者

How to make a folder dynamically with PHP

开发者 https://www.devze.com 2023-02-06 06:58 出处:网络
I want to allow the user to add something, and get a folder: example.com/foo But I DONT want the folder to actually be there, I want it to be made instantaneously, so tha开发者_开发技巧t I can stil

I want to allow the user to add something, and get a folder:

example.com/foo

But I DONT want the folder to actually be there, I want it to be made instantaneously, so tha开发者_开发技巧t I can still use the directory foo for private files (If I wanted to).

The name of the folder will be stored in a mySQL database, so all that remains is to map it. But how?


Maybe this is what you're looking for. Instead of doing example.com/foo, use example.com/something/foo. Then use an .htaccess rewrite rule:

RewriteEngine on
RewriteRule ^/?something/(\w+)$ fake.php?file=$1

Then you could have fake.php do everything that you need it to.

0

精彩评论

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