<i id='UOHNu'><tr id='UOHNu'><dt id='UOHNu'><q id='UOHNu'><span id='UOHNu'><b id='UOHNu'><form id='UOHNu'><ins id='UOHNu'></ins><ul id='UOHNu'></ul><sub id='UOHNu'></sub></form><legend id='UOHNu'></legend><bdo id='UOHNu'><pre id='UOHNu'><center id='UOHNu'></center></pre></bdo></b><th id='UOHNu'></th></span></q></dt></tr></i><div id='UOHNu'><tfoot id='UOHNu'></tfoot><dl id='UOHNu'><fieldset id='UOHNu'></fieldset></dl></div>

      <small id='UOHNu'></small><noframes id='UOHNu'>

      <tfoot id='UOHNu'></tfoot>
        <bdo id='UOHNu'></bdo><ul id='UOHNu'></ul>
      <legend id='UOHNu'><style id='UOHNu'><dir id='UOHNu'><q id='UOHNu'></q></dir></style></legend>
    1. Drupal - 使用 boostrap 在 Drupal 之外检查登录用户不起作用

      时间:2023-06-22
      <i id='zST0I'><tr id='zST0I'><dt id='zST0I'><q id='zST0I'><span id='zST0I'><b id='zST0I'><form id='zST0I'><ins id='zST0I'></ins><ul id='zST0I'></ul><sub id='zST0I'></sub></form><legend id='zST0I'></legend><bdo id='zST0I'><pre id='zST0I'><center id='zST0I'></center></pre></bdo></b><th id='zST0I'></th></span></q></dt></tr></i><div id='zST0I'><tfoot id='zST0I'></tfoot><dl id='zST0I'><fieldset id='zST0I'></fieldset></dl></div>

        • <bdo id='zST0I'></bdo><ul id='zST0I'></ul>
          <tfoot id='zST0I'></tfoot>
          <legend id='zST0I'><style id='zST0I'><dir id='zST0I'><q id='zST0I'></q></dir></style></legend>

          • <small id='zST0I'></small><noframes id='zST0I'>

                  <tbody id='zST0I'></tbody>

              • 本文介绍了Drupal - 使用 boostrap 在 Drupal 之外检查登录用户不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在拔头发试图弄清楚这一点.在 Drupal 目录之外时,我无法让 Bootstrap 正常工作.如果我在 Drupal 目录中运行此代码,它可以正常工作,但上一级不起作用.

                I'm pulling my hair out trying to figure this one out. I can't get the Bootstrap to work properly when outside of the Drupal dir. It works fine if I run this code in the Drupal dir, but up one level doesn't work.

                我的 Drupal 路径是/public_html/drupal/.我正在运行的脚本在/public_html 中.

                My Drupal path is /public_html/drupal/. The script I'm running is in /public_html.

                $user 没有返回登录的用户.我已经确定这不是跨域问题(即 www.domain.com 与 domain.com).

                $user is not returning the logged in user. I've made sure it's not a cross-domain issue (i.e. www.domain.com vs. domain.com).

                chdir('/path/to/drupal');
                
                include_once('./includes/bootstrap.inc');
                drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
                global $user;
                
                if ($user->uid) {
                    print "Logged in";
                } else {
                   print "Logged out";
                }
                

                推荐答案

                如果 Drupal 在您的单独脚本中未识别用户,则很有可能它没有收到正确的会话 cookie.您应该检查正常 Drupal 安装设置的 cookie,看看它们是否也发送到您的脚本.如果没有,请检查 Drupals settings.php 中的 $cookie_domain 变量 - 通常它已被注释掉,但您可能需要在您的情况下明确设置它.

                If the user is not recognized by Drupal in your separate script, chances are high that it does not receive the proper session cookie. You should check the cookies set by your normal Drupal install and see if they get send to your script as well. If not, check the $cookie_domain variable in your Drupals settings.php - ususally it is commented out, but you might need to set it explicitly in your case.

                这篇关于Drupal - 使用 boostrap 在 Drupal 之外检查登录用户不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Drush 9 别名文件应该在 Drupal 8 中的什么位置? 下一篇:drupal 视图对这个用例有用吗

                相关文章

                  <i id='bsASj'><tr id='bsASj'><dt id='bsASj'><q id='bsASj'><span id='bsASj'><b id='bsASj'><form id='bsASj'><ins id='bsASj'></ins><ul id='bsASj'></ul><sub id='bsASj'></sub></form><legend id='bsASj'></legend><bdo id='bsASj'><pre id='bsASj'><center id='bsASj'></center></pre></bdo></b><th id='bsASj'></th></span></q></dt></tr></i><div id='bsASj'><tfoot id='bsASj'></tfoot><dl id='bsASj'><fieldset id='bsASj'></fieldset></dl></div>
                1. <tfoot id='bsASj'></tfoot>

                    <small id='bsASj'></small><noframes id='bsASj'>

                    • <bdo id='bsASj'></bdo><ul id='bsASj'></ul>
                    <legend id='bsASj'><style id='bsASj'><dir id='bsASj'><q id='bsASj'></q></dir></style></legend>