-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex1.php
More file actions
57 lines (46 loc) · 974 Bytes
/
index1.php
File metadata and controls
57 lines (46 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* Created by PhpStorm.
* User: qingyun
* Date: 2019-04-18
* Time: 20:30
*/
//header()
class People{
#公共属性
public $name = "";
#构造方法 当类被实例化时执行
function __construct($name)
{
$this->name = $name;
}
function aa(){
echo "awdada";
}
#魔术方法
#设置属性时触发
function __set($name, $value)
{
$this->name = $value;
// TODO: Implement __set() method.
}
function __destruct()
{
echo "我被删除啦";
// TODO: Implement __destruct() method.
}
}
$aa = new People("aaa");
$aa->aa();
echo $aa->name;
$aa->name = "sssss";
echo $aa->name;
unset($aa->name);
class man extends People{
#私有属性 只能在对象内部实现
private $wif = "不清楚";
protected function dd($wd){
echo $wd;
}
# 访问控制修饰符3个 private 私有,protected 受保护, public 公共
}