① PYTHON 网站是否可以实现每次进入一个网站的时候直接在输入框内显示上一次输入的内容
当然可以,以下是一个登录页面的例子,在第一次点击登录后,第二次再打开网页就会自动填写第一次的内容:
<html>
<head><title>登录网页</title></head>
<body>
<form action="login.php" method="get" onsubmit="savePassword()">
用户名<input type="text" id="user" value="" />
密码<input type="password" id="pwd" value="" />
<input type="submit" value="登录" />
</form>
</body>
</html>
<script language="javascript">
function setCookie(name,value,expires,path,domain,secure)
{
var expSecs = expires*1000;
var expDate = new Date();
expDate.setTime(expDate.getTime()+expSecs);
var expString = ((expires=="-1") ? "" : (";expires="+expDate.toGMTString()))
var pathString = ((path==null) ? "" : (";path="+path))
var domainString = ((domain==null) ? "" : (";domain="+domain))
var secureString = ((secure==true) ? ";secure" : "" )
document.cookie = name + "=" + encodeURI(value) + expString + pathString + domainString + secureString;//encodeURI escape
}
function getCookie(name)
{
var result = null;
var myCookie = document.cookie + ";";
var searchName = name + "=";
var startOfCookie = myCookie.indexOf(searchName);
var endOfCookie;
if (startOfCookie != -1)
{
startOfCookie += searchName.length;
endOfCookie = myCookie.indexOf(";",startOfCookie);//分隔符;
if (endOfCookie==-1)
{
endOfCookie = mycookie.indexOf("&",startOfCookie);//分隔符&
}
result = decodeURI(myCookie.substring(startOfCookie, endOfCookie));//unescape decodeURI
}
if (result==null) result="";
return result;
}
window.onload=function(){
var user=getCookie("user");
if(user){document.getElementById("user").value=user;}
var pwd=getCookie("pwd");
if(pwd){document.getElementById("pwd").value=pwd;}
}
function savePassword()
{
var user=document.getElementById("user").value;
var pwd= document.getElementById("pwd").value;
setCookie("user", user, 24*60*60*7);//一周后失效
setCookie("pwd", pwd, 24*60*60*7);
return true;
}
</script>
</html>
② 配置完PHP环境后在地址栏输入http://localhost/phpMyAdmin/index.php弹出的是文件下载打开保存对话框
配置没有支持PHP,所以你得查看PHP是否可以正常运行了~~~
你先运行http://localhost/,如果这样可以显示出PHP的欢迎页面,那PHP就支持了,这个时候如果还是出现上面那种情况,那就说明你的那个phpMyAdmin没有安装好了。