语言和开发规则: Difference between revisions

Jump to navigation Jump to search
Line 516: Line 516:


==日志==
==日志==
Add logs to your code using function
使用函数在代码中添加日志:
 
<syntaxhighlight lang="PHP">
<syntaxhighlight lang="PHP">
dol_syslog($yourmessage, LOG_INFO|LOG_DEBUG|LOG_WARNING|LOG_ERR);
dol_syslog($yourmessage, LOG_INFO|LOG_DEBUG|LOG_WARNING|LOG_ERR);
Line 522: Line 523:


==工作目录==
==工作目录==
If you need to create a working directory, into your code, refer to it with
如果需要在代码中创建工作目录,请将该目录引用为 '''DOL_DATA_ROOT.'/mymodule'''' 。
'''DOL_DATA_ROOT.'/mymodule''''
 
可以使用以下代码在运行时使用代码创建目录:


The directory can be created into your code by the following function:
<syntaxhighlight lang="PHP">
<syntaxhighlight lang="PHP">
$mymoduledir=DOL_DATA_ROOT.'/mymodule';
$mymoduledir=DOL_DATA_ROOT.'/mymodule';
Line 531: Line 532:
</syntaxhighlight>
</syntaxhighlight>


If you need a directory to store temporary data, this directory must be '''DOL_DATA_ROOT.'/mymodule/temp''''
如果需要包含临时数据的目录,则该目录应为 '''DOL_DATA_ROOT.'/mymodule/temp' 。'''
 
=设计模式与面向对象编程=


=设计模式与对象程序设计=
==创建型模式 (GoF)==
设计模式由四人帮(Gang Of Four)定义(参见维基百科上的 [[wikipedia:Design pattern|设计模式]] )。


==创建设计框 (GoF)==
在Dolibarr中,没有实现特定的行为设计模式。有一些对象在设计思想上接近 Singletons 和 Fabriques,但在语法上不一致,以便尽可能与不是纯对象语言的PHP兼容。
Design patterns defined by the Gang Of Four (see wikipédia on [[wikipedia:Design pattern|Design patters]]).
No usage of such patterns is required. We found some objects next to Singletons or Factory but not completely compliant with syntax, this is to be compatible with PHP 4 that is not a pure object language.


==结构设计模式 (GoF)==
==企业设计模式(马丁·福勒)结构设计模式 (GoF)==
Design patterns defined by the Gang Of Four (see wikipédia on [[wikipedia:Design pattern|Design patters]]).  
Design patterns defined by the Gang Of Four (see wikipédia on [[wikipedia:Design pattern|Design patters]]).  
No usage of such patterns is required.
No usage of such patterns is required.
714

edits

Navigation menu