Drupal: how to access to Drupal's APIs with a standalone php script?

前端 未结 4 1263
南旧
南旧 2020-12-06 06:40

When I create a new script in a separate php file to run for Drupal, I need to add the following lines on top in order to access all Drupal APIs:

require_once \'./in

4条回答
  •  情歌与酒
    2020-12-06 07:30

    Yep, I use this:

    /** bootstrap drupal **/
    chdir("/path/to/drupal/site/htdocs");
    require_once './includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    

    And then just add whatever Drupal-specific code you need below that.

提交回复
热议问题