php极速入门2

  • 多维数组
$cars = array
  (
  array("Volvo",22,18),
  array("BMW",15,13),
  array("Saab",5,2),
  array("Land Rover",17,15)
  );
  ```
- 时间函数date(format,timestamp);format必选
 ```php
 
echo "今天是 " . date("Y/m/d") . "
"
; echo "今天是 " . date("Y.m.d") . "
"
; echo "今天是 " . date("Y-m-d") . "
"
; echo "今天是 " . date("l");) ?> © 2010- echo date("Y")?>
  • 创建日期mktime(hour,minute,second,month,day,year)
  • strtotime(time,now)
  • 日期参考
  • include/require

    • require 会生成致命错误(E_COMPILE_ERROR)并停止脚本
    • include 只生成警告(E_WARNING),并且脚本会继续
    • include ‘filename’;
    • 如果用 include 语句引用某个文件并且 PHP无法找到它,脚本会继续执行
  • FileSystem类C

    • readfile()
    • copy()
    • basename()/dirname()
    • disk_free_space()/disk_total_space()
    • fclose()/feof()
    • fgetc()
    • file()
    • file_exsits()
    • file_get_contents()
    • file_put_contents()
    • fileatime()/filectime()
    • filesize()
    • fopen()
    • fread()
    • fscanf()/fseek()

    - ftell()/fwrite()

    • cookie
    • setcookie(name, value, expire, path, domain); 位置标签之前
    • session_start();也在html之前
    • Email
    • mail(to,subject,message,headers,parameters)
  • 错误处理 die()


if(!file_exists("welcome.txt"))
 {
 die("File not found");
 }
else
 {
 $file=fopen("welcome.txt","r");
 }
?>
  • 异常处理try/cacth
  • 过滤器
    • filter_var() 通过一个指定的过滤器来过滤单一的变量
    • filter_var_array() 过相同的或不同的过滤器来过滤多个变量
    • filter_input 获取一个输入变量,并对它进行过滤
    • filter_input_array 获取多个输入变量,并通过相同的或不同的过滤器对它们进行过滤 -

你可能感兴趣的:(php)