<?php class Car { //增加構造函數與析構函數 function __construct() { echo '構造函數'; } function __destruct() { echo '析構函數'; } } $car = new Car(); /* c++中采用類同名函數定義構造函數 php中使用__construct函數定義構造函數 c++中采用~類同名函數 析構 php __destruct析構 */
<?php class Car { //增加構造函數與析構函數 function __construct() { echo '構造函數'; } function __destruct() { echo '析構函數'; } } $car = new Car(); /* c++中采用類同名函數定義構造函數 php中使用__construct函數定義構造函數 c++中采用~類同名函數 析構 php __destruct析構 */
2014-07-12
舉報