久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php登錄后怎么顯示名字

      php登錄后怎么顯示名字

      PHP session 變量用于存儲(chǔ)關(guān)于用戶會(huì)話(session)的信息,或者更改用戶會(huì)話(session)的設(shè)置。Session 變量存儲(chǔ)單一用戶的信息,并且對(duì)于應(yīng)用程序中的所有頁面都是可用的。

      我們可以在登錄后使用PHP輸出session中存儲(chǔ)的用戶名信息來實(shí)現(xiàn)php登錄后顯示名字。

      推薦:php服務(wù)器

      php登錄后顯示名字的方法:

      登錄表單:

      <!DOCTYPE html> <html> <head>     <meta charset="UTF-8">     <title>Login</title> </head> <body>     <form action="dologin.php" method="post">  username:<input type="text" name="username" /><br/>  password:<input type="password" name="password" />         <input type="submit" value="提交"/>     </form> </body> </html>

      php登錄代碼:

      dologin.php

      <?php     session_start();     $username = $_POST['username']?$_POST['username']:'';     $password = $_POST['password']?$_POST['password']:'';     $link = mysqli_connect('localhost', 'root', 'root', 'test');     mysqli_set_charset($link,'utf8');     $sql = "select password from user_dologin where username='".$username."'";     $res = mysqli_query($link,$sql);     $result = mysqli_fetch_assoc($res);       mysqli_close($link);     if($result['password'] == $password){         $_SESSION['username'] = $username;         $_SESSION['password'] = $password;//一般情況下session中不保存密碼信息         header("Location: index.php");     }else{         header("Location: login.html");//密碼錯(cuò)誤跳回登陸網(wǎng)頁     }

      登錄后顯示名字代碼:

      <?php session_start(); echo "username:".$_SESSION['username']."<br/>"; echo "password:".$_SESSION['password'];

      瀏覽器顯示效果:

      username:zhangsan password:123456

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)