-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
40 lines (36 loc) · 1001 Bytes
/
test.php
File metadata and controls
40 lines (36 loc) · 1001 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
<?php
header("Content-Type:text/html;charset=utf-8");
// class Di{
// private $_factory;
// public function set($id,$value){
// $this->_factory[$id] = $value;
// }
// public function get($id){
// $value = $this->_factory[$id];
// return $value();
// }
// }
// class User{
// private $_username;
// function __construct($username="") {
// $this->_username = $username;
// }
// function getUserName(){
// return $this->_username;
// }
// }
// //从这里开始看
// $di = new Di();
// $di->set("zhangsan",function(){
// return new User('张三');
// });
// $di->set("lisi",function(){
// return new User("李四");
// });
// echo $di->get("zhangsan")->getUserName();
// echo $di->get("lisi")->getUserName();
//
//
$arr = 'a:5:{s:5:"level";s:1:"2";s:7:"percent";a:2:{i:0;d:1;i:1;d:1;}s:10:"fanli_type";i:1;s:5:"price";s:4:"1.00";s:12:"gonghuoprice";s:4:"0.01";}';
$arr = unserialize($arr);
var_dump($arr);