因為我諗依家大多數人都用 PHP5 啦
我怕日後 PHP6 PHP7 PHP8 PHP9 blahblahblah 會取消兼容 Class name 做 Function name 既 Function 做 Constructor (?
如果搞兼容Mode (得閒無事) 就要改成咁
- 代碼: 選擇全部
<?php
// Do not forget to extend the class Core.
class core_class_example extends Core
{
function core_class_example(&$base)
{
/** Throw the base object to class Core and let Core::Core to do the things.
* More beautiful than:
$this->base = &$base;
*/
parent::Core($base);
}
function __constructor(&$base)
{
$this->core_class_example($base);
}
function a_function($username, $password)
{
/** Register a shortcut for the other core classes we needed.
* Call it by $this->[class_name]->a_function();
* More beautiful than:
$this->base->[class_name]->a_function();
* Don't use this function at the constructor ;P
$this->register_class('modules');
*/
$this->base->halt('This is an example.');
}
}?>