douguachan2879 2011-06-29 08:37
浏览 60
已采纳

在外部PHP文件中调用Drupal函数

How can I call a Drupal function or get the global variable in a PHP file which is located under the drupal installation folder. I doing it for the first time. Are there any files I need to include in my code in order to access the Drupal function or variables?

  • 写回答

4条回答 默认 最新

  • douwulu2576 2011-06-29 14:18
    关注

    Taken from the linked question in the comment above

    You need to Bootstrap Drupal in the external PHP file:

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

    Be sure to change the path to your Drupal installation, then add your code below the code posted above.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?