php学习笔记

 1 cookie部分

 2 1.setcookie("user","xiangzishi110",time()+3600);//设置user的变量,有效期为3600秒

 3 2.setcookie("user","",time()-3600);//注销

 4 3.$_COOKIE["user"];//调用

 5 4 if(isset($_COOKIE["user"])){}//判断是否设置了user的cookie

 6 

 7 session部分

 8 1.<?php session_start();?>//在head前就需要调用session_start();

 9 2.$_SESSION["user"];

10 3.if(isset($_SESSION["user"])){}

11 4.unset($_SESSION["user"]);//释放user的session

12 5.session_destroy();//彻底终结session

13 

14 mysql语句

15 insert into article (title,content,id) value ('第一本',‘这个书很好看’,null)

16 select * from article order by id desc

17 delete from article where id=1

18 update article set title='第二本' where id=2

19 

20 数据库操作

21 mysql_fetch_array

22 mysql_fetch_assoc 返回关联数组

23 mysql_num_rows($result) 返回查询结果条数

24 mysql_unbuffered_query()

25 mysql_query()

26 mysqli_real_escape_string( $link,$GET['username'] )

你可能感兴趣的:(学习笔记)