drupal 7 动态加载模块include文件

原文链接: http://www.cnblogs.com/heroking2000/archive/2012/04/20/2459200.html

drupal 7 动态加载include文件可以使用module_load_include函数,函数描述如下

/* *
 * Load a module include file.
 *
 * Examples:
 * @code
 *   // Load node.admin.inc from the node module.
 *   module_load_include('inc', 'node', 'node.admin');
 *   // Load content_types.inc from the node module.
 *   module_load_include('inc', 'node', 'content_types');
 * @endcode
 *
 * Do not use this function to load an install file, use module_load_install()
 * instead. Do not use this function in a global context since it requires
 * Drupal to be fully bootstrapped, use require_once DRUPAL_ROOT . '/path/file'
 * instead.
 *
 * @param $type
 *   The include file's type (file extension).
 * @param $module
 *   The module to which the include file belongs.
 * @param $name
 *   (optional) The base file name (without the $type extension). If omitted,
 *   $module is used; i.e., resulting in "$module.$type" by default.
 *
 * @return
 *   The name of the included file, if successful; FALSE otherwise.
 
*/
function module_load_include( $type$module$name =  NULL)
 

转载于:https://www.cnblogs.com/heroking2000/archive/2012/04/20/2459200.html

猜你喜欢

转载自blog.csdn.net/weixin_30532973/article/details/94968068