<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 之外检查登录用户不起作用

      Drupal - using boostrap to check logged in user outside of Drupal not working(Drupal - 使用 boostrap 在 Drupal 之外检查登录用户不起作用)
      <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 之外检查登录用户不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    <tbody id='bsASj'></tbody>
                    <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>
                  • <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>