我不知道我是否可以在这里询问 CMSMadeSimple,但这里可以。我看过其他 CMS 和框架问题。
我正在研究 CMSMS 的代码,以便学习制作自己的 CMS。我认为这确实是一个 php 和设计问题,但在这里:
http://phpxref.com/xref/cmsmadesimple/nav.html?_functions/index.html
在 CMSModule 下,这是所有必须从它们继承的类,它们具有以下代码:
class CMSModule
479 {
480 /**
481 * ------------------------------------------------------------------
482 * Initialization Functions and parameters
483 * ------------------------------------------------------------------
484 */
485 var $cms;
486 var $curlang;
487 var $langhash;
488 var $params;
.....
509 function CMSModule()
510 {
511 global $gCms;
512 $this->cms =& $gCms;
513 $this->config =& $gCms->GetConfig();
514
最后一部分在说什么?我不明白。特别是在班级较低时,它具有:
753 /**
754 * Returns the cms->config object as a reference
755 */
756 function & GetConfig()
757 {
758 global $gCms;
759 $config = &$gCms->GetConfig();
760 return $config;
761 }
762
763 /**
764 * Returns the cms->db object as a reference
765 */
766 function & GetDb()
767 {
768 global $gCms;
769 $db = &$gCms->GetDb();
770 return $db;
771 }
772
这些看起来他们几乎什么都不做,或者他们一直在称自己为永远......没有真正的数据库东西可以启动。
我希望通过引用来了解这里的设计。
谢谢你。