摘要: //加载类: include("./Ren.class.php"); include "./Ren.class.php"; require("./Ren.class.php"); require "./Ren.class.php"; require_once("./Ren.class.php"); require_once "./Ren.class.php"; //自动加载类的方法 /... 阅读全文
posted @ 2016-10-27 15:54 学生Q 阅读(110) 评论(0) 推荐(0)
摘要: //普通成员属于对象 //静态成员属于类 //关键字 static //self关键字 在类里面代表该类 //在静态方法里面不能调用普通成员 //在普通成员里面能调用普通成员 class FenBi { public $length;//粉笔长度 public static $color;//粉笔颜色 static function show() { e... 阅读全文
posted @ 2016-10-25 15:22 学生Q 阅读(127) 评论(0) 推荐(0)
摘要: 面对对象三大特性 封装 目的:让类更安全 做法:成员变量变为私有的,通过方法来间接操作成员变量,在方法里面加限制条件 继承 概念:子类可以继承父类的一切 方法重写:在子类里面对父类的方法进行重写 特点:单继承:一个子类只能有一个父类,一个父类可以派生出多个子类 多态(运行多态) 概念:当父类引用指向 阅读全文
posted @ 2016-10-25 10:30 学生Q 阅读(114) 评论(0) 推荐(0)
摘要: 定义数组$attr = array(); $attr[0] = 1;索引数组$attr = array(1,2,3,4);关联数组$attr = array("code"=>"p001","name"=>"张三"); 二维数组$attr = array( array(), array()); 数组遍 阅读全文
posted @ 2016-10-24 10:51 学生Q 阅读(253) 评论(0) 推荐(0)
摘要: $s = "he8llo5wor6ld";$s = preg_replace("/\d/","#",$s); 按照正则表达式替换$attr = preg_split("/\d/",$s); 按照正则表达式拆分$arr = array();preg_match("/\d/",$s,$arr); 匹配满 阅读全文
posted @ 2016-10-23 10:47 学生Q 阅读(145) 评论(0) 推荐(0)
摘要: 函数四要素: 返回类型 函数名 参数列表 函数体 function show() { } 最简单的函数定义方式 function Show() {echo "hello";} Show(); 有参数的函数 function show($a) {echo $a;} show("hello"); 有返回 阅读全文
posted @ 2016-10-21 16:00 学生Q 阅读(114) 评论(0) 推荐(0)
摘要: <body><?php // 注释 /* */ 注释 //输出语法 echo"hello <br>"; echo"word","world"; //可以输出多个字符 print"abc"; //只能输入一个字符 print_r(); //打印数组 var_dump(); //输入变量及类型 //变量 阅读全文
posted @ 2016-10-21 10:49 学生Q 阅读(200) 评论(0) 推荐(0)
摘要: 一、数学函数 数学函数主要用于处理数字,包括整型、浮点数等。 ABS(x) 返回x的绝对值 SELECT ABS(-1) -- 返回1 CEIL(x),CEILING(x) 返回大于或等于x的最小整数 SELECT CEIL(1.5) -- 返回2 FLOOR(x) 返回小于或等于x的最大整数 SE 阅读全文
posted @ 2016-10-20 14:48 学生Q 阅读(160) 评论(0) 推荐(0)
摘要: 10、 查询Score表中的最高分的学生学号和课程号。(子查询或者排序) select sno,cno from score where degree=(select max(degree) from score ) || select * from score order by degree de 阅读全文
posted @ 2016-10-20 10:19 学生Q 阅读(356) 评论(0) 推荐(0)
摘要: 连接查询: select * from 表名1,表名2#形成笛卡尔积 select * from 表名1,表名2 where 表名1.列名=表名2.列名 // select 表名1.列名, 表名1.列名1,表名2.列名 as'民族' from 表名1,表名 where 表名1.列名=表名2.列名 s 阅读全文
posted @ 2016-10-17 15:18 学生Q 阅读(192) 评论(0) 推荐(0)