doumaqing6652 2015-09-23 12:08
浏览 71
已采纳

生成动态网页的URL

I recently was asked to look into a possibility of generating a url that would lead to a dynamic page.

Here is my use case: A client comes onto a page like http://www.example.com/customvideo here they enter a predefined form with things like company name, adress and upload a image of their logo.

After that they click on the button "make video" (or whatever) and a url is generated that leads to a page where their info is inputted in a page with some css animations.

So I had in mind that all their info will be uploaded to the server in a folder with a generated random number like "10010" and in here all their information from the form will be uploaded in a single info.json file and their logo is resized and uploaded as logo.jpg to that same folder.

The url generated will then be like http://www.example.com/customvideo/10010 The url sees the "10010" part, looks up the folder, gets the json file. Inputs the data in the fields I specify on the page and grabs the logo.jpg and places it on the page which then animates CSS.

Is this a doable scenario?

Is something like this even possible?

  • 写回答

2条回答 默认 最新

  • doubeiji2602 2015-09-23 12:24
    关注

    Yes - it's a common scenario, called "URL rewriting". It typically requires you to have access to your web service config (e.g. Apache, NGINX), or to add entries to .htaccess (not all hosts allow this) but it's pretty straightforward.

    You create a rewrite rule that says "every time someone requests http://www.example.com//customvideo/parameter, map that to http://www.example.com/customvideo/handler.php?client=parameter".

    In Apache, that would be:

    RewriteRule    ^customvideo/([0-9]+)/?$    handler.php?client=$1    [NC,L]    # Handle video requests
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试