看板 [ PHP ]
討論串[請益] Class的一些問題
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓0(0推 0噓 1→)留言1則,0人參與, 最新作者MrMarcus (請勿忘記密碼)時間19年前 (2007/01/23 23:44), 編輯資訊
0
0
0
內容預覽:
PHP 4的話,你可以這樣寫:. class DataSource {. ..... .... 略. function & singleton() {. static $instance;. if(!$instance) {. $instance = new DataSource();. }. re
(還有287個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者superGA (kid...)時間19年前 (2007/01/23 19:25), 編輯資訊
0
0
0
內容預覽:
class MyClass {. private static $instance;. public function MyClass()//建構子. {. self::$instance =& $this;. }. public static function &get_instance(). {
(還有200個字)

推噓1(1推 0噓 2→)留言3則,0人參與, 最新作者StubbornLin (Victor)時間19年前 (2007/01/23 16:38), 編輯資訊
0
0
1
內容預覽:
function getDataSource(){. static $IsCreated = false;. static $DataSource ;. if(!$IsCreated){. $DataSource = new DataSource;. $IsCreated = true;. }. r
(還有1078個字)
首頁
上一頁
1
下一頁
尾頁