[英]How can I redirect user to his directory when he enters his ID
Can anybody help me in making a input box where user enters his id and when he clicks on continue he will be redirected to his id folder on my website. 有人可以帮助我在用户输入ID的输入框中创建一个内容吗?当他单击继续时,他将被重定向到我网站上的ID文件夹中。 Like this: user opens website example.com and enters his id and click on continue then he will be redirected to exaple.com/(user id).
这样:用户打开网站example.com并输入其ID,然后单击“继续”,那么他将被重定向到exaple.com/(用户ID)。
Html Code : HTML代码:
<input type="text" name="userName" id="userName">
<button name="contiueButton" id="contiueButton"> Continue </button>
Jquery: jQuery:
$( document ).ready(function() {
$("#contiueButton").on("click",function(){
var userName = $("#userName").val();
//validate username like check empty, check exist in db
var url ="exaple.com/"+userName;
window.location.href = url;
});
});
Try this: 尝试这个:
$userid = $_GET['id'];
mkdir($userid, 0700); // to create new directory
header("location=example.com/".$userid."/"); // to redirect
Happy Coding... 快乐编码...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.