<tfoot id='TYa0E'></tfoot>

    <bdo id='TYa0E'></bdo><ul id='TYa0E'></ul>

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

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

      1. 添加 url() 会破坏 hook_mail 实现

        时间:2023-06-22
        • <tfoot id='6SQMI'></tfoot>

            <small id='6SQMI'></small><noframes id='6SQMI'>

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

                <tbody id='6SQMI'></tbody>
                  <bdo id='6SQMI'></bdo><ul id='6SQMI'></ul>
                  <legend id='6SQMI'><style id='6SQMI'><dir id='6SQMI'><q id='6SQMI'></q></dir></style></legend>
                  本文介绍了添加 url() 会破坏 hook_mail 实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在用 Drupal-7 编写一个模块,该模块动态地向访客发送一次性登录链接.一切正常,直到我将链接添加到 $message 数组,当它窒息时.如果我执行 dpm($message) 链接会出现在 $message['body'] 数组中,正如我所期望的.如果我用 url() 函数注释掉该行,则一切正常.为什么 php/Drupal 在这个愚蠢的小链接上卡住了?

                  I'm writing a module in Drupal-7 that dynamically sends a one-time login link to guests. Everything fires fine until I add the link to the $message array, when it chokes. If I do a dpm($message) the link appears in the $message['body'] array, as I would expect. If I comment out the line with the url() function, everything works as it should. Why is php/Drupal choking on this silly little link?

                  /*
                   * Implement hook_mail().
                   */
                  
                  function rsvp_mail($key, &$message, $params) {
                      switch($key) {
                        case "send invite" :
                          $timestamp = REQUEST_TIME;
                          $account = $params['account'];
                          $message['subject'] = "And invitation for $account->name";
                          $message['body'][] = 'Some body text.';
                          $message['body'][] = 'Some more text!';
                          //here's the line that's breaking my brain:
                          $message['body'][] = url( 'http://wedding.juicywatermelon.com/rsvp/' . $account->uid . "/" . $timestamp . "/" . md5($account->pass . $timestamp) . "/" . 'user/' . $account->uid . '/edit/Wedding');             
                          break;
                      }
                    }
                  

                  ps - 为简洁起见,我有代码在单独的函数调用中生成链接并将其移至钩子实现.然而,这对行为没有影响.

                  ps - I had the code to generate the link in a seperate function call and moved it to the hook implementation for brevity. This, however had no effect on the behaviour.

                  以及生成电子邮件的代码:

                  and the code that generates the email:

                  function rsvp_mail_send($account) {
                    $module = 'rsvp';
                    $from = "email@gmail.com";
                    $key = "send invite";
                    $params['account'] = $account;
                    $to = $account->mail;
                    $language = language_default();
                    $send = TRUE;
                    $result = drupal_mail($module, $key, $to, $language, $params, $from, $send);
                  }
                  

                  推荐答案

                  你需要在 url() 函数中添加一个额外的参数,称为 options,它是一个数组,在这个数组中使用键 'absolute' 并设置将其设置为 TRUE 表示您作为第一个参数传递的 URI 是绝对 URL.

                  You need to add an extra argument to the url() function which is called options, it's an array and in this array use the key 'absolute' and set it to TRUE to indicate that the URI that you pass as a first argument is an absolute URL.

                  查看文档页面了解更多信息:http://api.drupal.org/api/drupal/includes--common.inc/function/url/7

                  See the documentation page for more information: http://api.drupal.org/api/drupal/includes--common.inc/function/url/7

                  这篇关于添加 url() 会破坏 hook_mail 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:自定义形式的 Drupal Imagfield/Filefield 下一篇:我应该在 Drupal 中将 ImageMagick 还是 GD2 与 ImageAPI 一起使用?

                  相关文章

                  <legend id='nl9Aq'><style id='nl9Aq'><dir id='nl9Aq'><q id='nl9Aq'></q></dir></style></legend>
                  <tfoot id='nl9Aq'></tfoot>

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

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