中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

網(wǎng)站開發(fā)文檔范文今日國際新聞頭條15條

網(wǎng)站開發(fā)文檔范文,今日國際新聞頭條15條,中煤第一建設(shè)公司網(wǎng)站,做網(wǎng)站需要什么人員文章目錄 時(shí)間函數(shù)dategetdatetime 使用數(shù)組實(shí)現(xiàn)登錄注冊和修改密碼簡單數(shù)組增加元素方法修改元素方法刪除元素方法 具體實(shí)現(xiàn)方法數(shù)組序列化數(shù)組寫入文件判斷元素是否在關(guān)聯(lián)數(shù)組中(登錄功能實(shí)現(xiàn))實(shí)現(xiàn)注冊功能實(shí)現(xiàn)修改admin用戶密碼功能 時(shí)間函數(shù) 時(shí)區(qū)&am…

文章目錄

  • 時(shí)間函數(shù)
    • date
    • getdate
    • time
  • 使用數(shù)組實(shí)現(xiàn)登錄注冊和修改密碼
    • 簡單數(shù)組
      • 增加元素方法
      • 修改元素方法
      • 刪除元素方法
    • 具體實(shí)現(xiàn)方法
      • 數(shù)組序列化
      • 數(shù)組寫入文件
      • 判斷元素是否在關(guān)聯(lián)數(shù)組中(登錄功能實(shí)現(xiàn))
      • 實(shí)現(xiàn)注冊功能
      • 實(shí)現(xiàn)修改admin用戶密碼功能

時(shí)間函數(shù)

時(shí)區(qū):中國 東8區(qū)
php.ini 時(shí)區(qū)設(shè)置為:date.timezone = Asia/Shanghai
分號為注釋
H = 小時(shí) i = 分鐘 s = 秒鐘
Ymd = 年月日

date

<?php//date  格式化一個(gè)本地時(shí)間/日期//getdate getdate 是一個(gè)數(shù)組,取數(shù)組中的值//time  返回當(dāng)前的unix時(shí)間戳header("Content-Type: text/html; charset=utf-8");$a = date ("H:i:s");$b = date ("Ymd");echo $b;echo "<br>";echo $a;

getdate

getdate 是一個(gè)數(shù)組

header("Content-Type: text/html; charset=utf-8");$a = date ("H:i:s");$b = date ("Ymd");$c = getdate ();echo $b;echo "<br>";echo $a;echo "<br>";var_dump($c);
array(11) { ["seconds"]=> int(17) ["minutes"]=> int(37) ["hours"]=> int(11) ["mday"]=> int(4) ["wday"]=> int(4) ["mon"]=> int(1) ["year"]=> int(2024) ["yday"]=> int(3) ["weekday"]=> string(8) "Thursday" ["month"]=> string(7) "January" [0]=> int(1704339437) }

取數(shù)組的時(shí)間戳 [0]=> int(1704339437) ,有了時(shí)間戳就可以將時(shí)間數(shù)組讀取出來

header("Content-Type: text/html; charset=utf-8");$a = date ("H:i:s");$b = date ("Ymd");$c = getdate ();echo $b;echo "<br>";echo $a;echo "<br>";var_dump($c);echo $c['0'];

有了時(shí)間戳就可以隨意輸出你想要的時(shí)間,具體代碼如下

header("Content-Type: text/html; charset=utf-8");$a = date ("Ymd H:i:s",1704349737);//$b = date ("Ymd",1704349737);$c = getdate (1704349737);echo $a;echo "<br>";echo $a;echo "<br>";var_dump($c);echo "<br>";echo $c['0'];echo '<br>';echo $c["year"].$c["mon"].$c["mday"]." ".$c["hours"].":".$c["minutes"].":".$c["seconds"];

time

time()函數(shù)返回當(dāng)前的uinx時(shí)間戳

header("Content-Type: text/html; charset=utf-8");$a = date ("Ymd H:i:s",1704349737);//$b = date ("Ymd",1704349737);$c = getdate (1704349737);echo $a;echo "<br>";echo $a;echo "<br>";var_dump($c);echo "<br>";echo $c['0'];echo '<br>';echo $c["year"].$c["mon"].$c["mday"]." ".$c["hours"].":".$c["minutes"].":".$c["seconds"];echo '<br>';echo time();

使用數(shù)組實(shí)現(xiàn)登錄注冊和修改密碼

數(shù)組函數(shù)的用途:1、增加一個(gè)元素 2、修改元素 3、刪除元素

簡單數(shù)組

<?phpheader("Content-Type: text/html; charset=utf-8");$a = array('鼠','牛','虎','龍','蛇');  var_dump($a);?>

增加元素方法

<?phpheader("Content-Type: text/html; charset=utf-8");$user=array('admin'=>'123456','test'=>'123','root'=>'789456');//關(guān)聯(lián)數(shù)組var_dump( $user );$user['administrator'] = 'admin';//往數(shù)組里增加一個(gè)元素echo "<br>";var_dump( $user );?>

修改元素方法

<?phpheader("Content-Type: text/html; charset=utf-8");$user=array('admin'=>'123456','test'=>'123','root'=>'789456');var_dump( $user );$user['administrator'] = 'admin';//往數(shù)組里增加一個(gè)元素echo "<br>";var_dump( $user );$user['administrator'] = 'admin123456';//修改元素echo "<br>";var_dump( $user );
?>

刪除元素方法

header("Content-Type: text/html; charset=utf-8");//$a = array('鼠','牛','虎','龍','蛇');  //var_dump($a);$user=array('admin'=>'123456','test'=>'123','root'=>'789456');var_dump( $user );$user['administrator'] = 'admin';//往數(shù)組里增加一個(gè)元素echo "<br>";var_dump( $user );$user['administrator'] = 'admin123456';//修改administrator 元素echo "<br>";var_dump( $user );unset($user["administrator"]);//刪除administrator 元素echo "<br>";var_dump( $user );

具體實(shí)現(xiàn)方法

數(shù)組序列化

數(shù)組不是字符串想寫到文件里面需要序列化
序列化之后會返回一個(gè)字符串

serialize() //序列化函數(shù)
header("Content-Type: text/html; charset=utf-8");$user=array('admin'=>'123456','test'=>'123','root'=>'789456');//數(shù)組$a=serialize($user);//序列化數(shù)組$userfile_put_contents('userpassword.txt',$a);//將$a的數(shù)據(jù)寫到userpassword.txt

數(shù)組寫入文件

$a=file_get_contents("userpassword.txt");//讀序列化后的文件,內(nèi)容為字符串$b=unserialize($a);//反序列化,將字符串轉(zhuǎn)為數(shù)組的過程var_dump($b);

判斷元素是否在關(guān)聯(lián)數(shù)組中(登錄功能實(shí)現(xiàn))

前端代碼

<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><title>登錄頁面</title></head><body><form action="shuzu.php" method="get">用戶名:<input  type="text" name="username">密碼:<input   type="text" name="password"><input  type="submit"></form></body></html>

后端代碼

//需求 1、登錄  2、注冊  3、修改密碼header("Content-Type: text/html; charset=utf-8");$u = $_GET["username"];$p = $_GET["password"];/*//$a = array('鼠','牛','虎','龍','蛇');  //var_dump($a);$user=array('admin'=>'123456','test'=>'123','root'=>'789456');var_dump( $user );$user['administrator'] = 'admin';//往數(shù)組里增加一個(gè)元素echo "<br>";var_dump( $user );$user['administrator'] = 'admin123456';//修改administrator 元素echo "<br>";var_dump( $user );unset($user["administrator"]);//刪除administrator 元素echo "<br>";var_dump( $user );*//*header("Content-Type: text/html; charset=utf-8");$user=array('admin'=>'123456','test'=>'123','root'=>'789456');//數(shù)組$a=serialize($user);//序列化數(shù)組$user,將變量轉(zhuǎn)換為字符串file_put_contents('userpassword.txt',$a);//將$a的數(shù)據(jù)寫到userpassword.txt*/$i=1;$a=file_get_contents("userpassword.txt");//讀序列化后的文件,內(nèi)容為字符串$b=unserialize($a);//反序列化,將字符串轉(zhuǎn)為數(shù)組的過程//var_dump($b);foreach($b as $key=>$value){    //循壞遍歷關(guān)聯(lián)數(shù)組$bif($u == $key && $p == $value){   //$u = $key  $p = $value$i=0;   //匹配成功將$i 設(shè)置為0 輸出 "登錄成功"echo "登錄成功";break;}}if($i == 1){echo "登錄失敗";}    //未匹配成功$i=1 輸出 登錄失敗

實(shí)現(xiàn)注冊功能

前端頁面

<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><title>注冊</title></head><body><form action="register.php" method="POST">用戶名:<input  type="text" name="username">密碼: <input   type="text" name="password">確認(rèn)密碼:<input type="text" name="password1"><input  type="submit"></form></body></html>

后端頁面

//需求 1、登錄  2、注冊  3、修改密碼header("Content-Type: text/html; charset=utf-8");$u = $_POST["username"];$p = $_POST["password"];$p1 = $_POST ["password1"];if ($p != $p1) {  //如果$p 不等于 $p1 則退出代碼執(zhí)行echo "兩次密碼不一致";exit;}$a=file_get_contents("userpassword.txt");//讀序列化后的文件,內(nèi)容為字符串$b=unserialize($a);//反序列化,將字符串轉(zhuǎn)為數(shù)組的過程//var_dump($b);foreach($b as $key=>$value){    //循壞遍歷關(guān)聯(lián)數(shù)組$bif($u == $key ){   //$u = $key  echo "用戶已存在"; //查找用戶是否存在exit; //退出,代碼不再執(zhí)行}} $b[$u]=$p; //添加用戶元素$c=serialize($b); //序列化file_put_contents("userpassword.txt",$c);//寫入文件echo"注冊成功";

實(shí)現(xiàn)修改admin用戶密碼功能

前端代碼

<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><title>改密碼</title></head><body><h1>admin 修改密碼</h1><form action="changepassword.php?username=admin" method="post">舊密碼:<input  type="password" name="password">新密碼:<input  type="password" name="password1"><input  type="submit"></form></body></html>

后端代碼

//需求 1、登錄  2、注冊  3、修改密碼header("Content-Type: text/html; charset=utf-8");$u = $_GET["username"];$p = $_POST["password"];$p1 = $_POST["password1"];if ($p != $p1) {  //如果$p 不等于 $p1 則退出代碼執(zhí)行echo "兩次密碼不一致";exit;}$i=1;$a = file_get_contents("..\userpassword.txt");$b = unserialize($a);foreach($b as $key=>$value){    //循壞遍歷關(guān)聯(lián)數(shù)組$bif($u == $key ){   //$u = $key  $b[$u]=$p;$c=serialize($b); //序列化file_put_contents("..\userpassword.txt",$c);//寫入文件echo"密碼修改成功";break;}else{$i=0;}}if($i=0){echo"用戶不存在";}

http://m.risenshineclean.com/news/60558.html

相關(guān)文章:

  • 做企業(yè)展示版網(wǎng)站貴嗎軟文推廣軟文營銷
  • 上傳網(wǎng)站安裝教程網(wǎng)站推廣去哪家比較好
  • 網(wǎng)站上的動圖都怎么做的成都建設(shè)網(wǎng)官網(wǎng)
  • 廣東省建設(shè)廳官方網(wǎng)站多少錢外鏈在線發(fā)布工具
  • 常用的搜索引擎網(wǎng)站建網(wǎng)站用什么軟件
  • 網(wǎng)站建站制作價(jià)格沈陽網(wǎng)站制作
  • 桂林網(wǎng)站建設(shè)lieyanma做好的網(wǎng)站怎么優(yōu)化
  • 手機(jī)做任務(wù)傭金的網(wǎng)站windows優(yōu)化大師是什么軟件
  • dreamweaver網(wǎng)站建設(shè)大賽方案優(yōu)化服務(wù)
  • 中山市做網(wǎng)站專業(yè)的百度地圖關(guān)鍵詞優(yōu)化
  • 域名查詢網(wǎng)站百度seo整站優(yōu)化
  • 免費(fèi)做外貿(mào)的網(wǎng)站免費(fèi)推廣的平臺
  • 網(wǎng)站優(yōu)化公司哪個(gè)好推廣app
  • 如何建設(shè)購物網(wǎng)站seo外包顧問
  • 企業(yè)文化手冊信息流優(yōu)化師是什么
  • 建設(shè)京東類的網(wǎng)站需要什么流程營銷渠道名詞解釋
  • 網(wǎng)站建設(shè)項(xiàng)目介紹查收錄網(wǎng)站
  • 長沙做網(wǎng)站價(jià)格網(wǎng)絡(luò)運(yùn)營是什么意思
  • 手機(jī)網(wǎng)站欣賞谷歌怎么投放廣告
  • 東莞網(wǎng)站建設(shè)方案表怎么做市場營銷和推廣
  • 網(wǎng)頁設(shè)計(jì)與制作實(shí)例教程方其桂seo教程網(wǎng)站優(yōu)化
  • 建設(shè)假網(wǎng)站2345瀏覽器網(wǎng)頁版
  • 義烏 網(wǎng)站制作百度注冊公司網(wǎng)站
  • 網(wǎng)站建設(shè)基礎(chǔ)教程如何做線上推廣
  • 純凈水企業(yè)怎樣做網(wǎng)站競價(jià)外包
  • 建設(shè)網(wǎng)站需要哪些內(nèi)容福州整站優(yōu)化
  • thinkphp做的上線網(wǎng)站電商培訓(xùn)機(jī)構(gòu)
  • 犀牛云 做網(wǎng)站優(yōu)化關(guān)鍵詞排名優(yōu)化公司
  • 長安營銷型網(wǎng)站建設(shè)seo優(yōu)化范疇
  • 注冊一個(gè)網(wǎng)站流程關(guān)鍵詞推廣優(yōu)化外包