Calling Drupal functions in external PHP file

前端 未结 4 865
终归单人心
终归单人心 2021-01-02 06:18

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

4条回答
  •  悲&欢浪女
    2021-01-02 07:10

    If the above explained example doesn't work try this:

    $path = $_SERVER['DOCUMENT_ROOT'];
    chdir($path."/drupal");
    define('DRUPAL_ROOT', getcwd()); //the most important line
    require_once './includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
    

提交回复
热议问题