开发者

How to generate automatic url which is given permission for 3 times in PHP?

I would like to generate a URL which will have a unique code tail at the and only will be used 3 times. After accessing 3 times from the link. the url will expire. How can I do this? Basically I think I need to create a database and map the permission for the url and have acountdown number? is there any better way of doing this? An example of this is in facebook you can just copy and send a link to the开发者_StackOverflow中文版 people to see your pictures without going online or being your friends. ?


You've already thought of your own solution! There is no easier way.

Lets have a look at what you need:

  1. An url referring to a specific page (or an image in your case)
  2. A limit of times your url can be visited
  3. A count of the amount of visits

All 3 requirements seem to need a database. You can use an alternative database, such as local xml files but that would be way more work than using a mysql database for instance.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜