我试图在名为“定制”我的代码的子文件夹中从‘drupal_bootstrap’调用temp.php,如下所示:
chdir('../');
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);一旦我调用了temp.php,我就得到了Drupal主页。
我还尝试了一个显式的物理路径,但是没有用,代码如下:
define('DRUPAL_ROOT', '/var/htdocs/drupal7');
require_once '../includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);位于以下文件夹结构下的temp.php:
- var
-- htdocs
--- drupal7
---- custom
----- temp.php发布于 2013-03-15 17:53:18
看看http://drupal.org/project/js,他们实现了一个引导drupal的自定义js.php。
/**
* @file
* Callback page that serves custom JavaScript requests on a Drupal installation.
*/
/**
* @var The Drupal root
*/
define('DRUPAL_ROOT', getcwd());
/**
* @} End of "Required core files".
*/
/**
* @name Required core files
* @{
* The minimal core files required to be able to run a js request
*/
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/module.inc';
require_once DRUPAL_ROOT . '/includes/unicode.inc';
require_once DRUPAL_ROOT . '/includes/file.inc';
/**
* @} End of "Required core files".
*/
// Do basic bootstrap to make sure the database can be accessed
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);发布于 2016-06-23 16:16:47
基本上,这应该足够了(或者至少对我来说,从位于站点根文件夹中的test.php文件运行Drupal (7.44版本)函数就足够了):
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);https://drupal.stackexchange.com/questions/65654
复制相似问题