老师,这节课如果返回数据用PHP该如何写?
老师,我不会JSP,用PHP的话该怎么写呢?能放一下源码吗?
老师,我不会JSP,用PHP的话该怎么写呢?能放一下源码吗?
2015-01-04
<?php //index.php if ($_COOKIE['user'] || $_COOKIE['pass']) { echo "welocome index"; } else { header("Location:test.php"); }
<?php //test.php if(isset($_POST['user']) && isset($_POST['pass'])){ setcookie("user", $_POST['user'], time()+3600); setcookie("pass", $_POST['pass'], time()+3600); } ?> <form action="" method="post"> <input type="text" name="user" /> <input type="password" name="pass" /> <input type="submit" value="submit"> </form>
private Handler handler = new Handler(){ public void handleMessage(android.os.Message msg) { //设置cookie; CookieSyncManager.createInstance(MainActivity.this); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); Cookie cookie = (Cookie) msg.obj; String str = cookie.getName()+"="+cookie.getValue(); cookieManager.setCookie("192.168.0.105", str); CookieSyncManager.getInstance().sync(); wv.loadUrl("http://192.168.0.105/index.php"); }; };
举报