@@ -34,7 +34,13 @@ private static function getInstance()
34
34
}
35
35
else
36
36
{
37
- self ::$ cache = 'none ' ;
37
+ session_start ();
38
+ self ::$ cache = 'session ' ;
39
+ self ::$ originData = $ _SESSION ['LaravelTwStreetnameOrigin ' ];
40
+ self ::$ citys = $ _SESSION ['LaravelTwStreetnameCitys ' ];
41
+ self ::$ countrys = $ _SESSION ['LaravelTwStreetnameCountrys ' ];
42
+ self ::$ streets = $ _SESSION ['LaravelTwStreetnameStreets ' ];
43
+ self ::$ zipCode = $ _SESSION ['LaravelTwStreetnameZipCode ' ];
38
44
}
39
45
40
46
//載入街道Json資料
@@ -44,6 +50,8 @@ private static function getInstance()
44
50
if (self ::$ cache =='apcache ' && count (self ::$ originData ) > 0 )
45
51
{
46
52
apc_store ('LaravelTwStreetnameOrigin ' , self ::$ originData );
53
+ }else {
54
+ $ _SESSION ['LaravelTwStreetnameOrigin ' ] = self ::$ originData ;
47
55
}
48
56
49
57
}
@@ -59,6 +67,8 @@ private static function getInstance()
59
67
if (self ::$ cache =='apcache ' && count (self ::$ zipCode ) > 0 )
60
68
{
61
69
apc_store ('LaravelTwStreetnameZipCode ' , self ::$ zipCode );
70
+ }else {
71
+ $ _SESSION ['LaravelTwStreetnameZipCode ' ] = self ::$ zipCode ;
62
72
}
63
73
}
64
74
@@ -73,6 +83,8 @@ private static function getInstance()
73
83
if (self ::$ cache =='apcache ' && count (self ::$ citys ) > 0 )
74
84
{
75
85
apc_store ('LaravelTwStreetnameCitys ' , self ::$ citys );
86
+ }else {
87
+ $ _SESSION ['LaravelTwStreetnameCitys ' ] = self ::$ citys ;
76
88
}
77
89
}
78
90
//載入鄉鎮區
@@ -83,6 +95,8 @@ private static function getInstance()
83
95
if (self ::$ cache =='apcache ' && count (self ::$ countrys ) > 0 )
84
96
{
85
97
apc_store ('LaravelTwStreetnameCountrys ' , self ::$ countrys );
98
+ }else {
99
+ $ _SESSION ['LaravelTwStreetnameCountrys ' ] = self ::$ countrys ;
86
100
}
87
101
}
88
102
//載入街道
@@ -98,6 +112,8 @@ private static function getInstance()
98
112
if (self ::$ cache =='apcache ' && count (self ::$ streets ) > 0 )
99
113
{
100
114
apc_store ('LaravelTwStreetnameStreets ' , self ::$ streets );
115
+ }else {
116
+ $ _SESSION ['LaravelTwStreetnameStreets ' ] = self ::$ streets ;
101
117
}
102
118
}
103
119
}
0 commit comments