<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 实现

        Adding url() breaks hook_mail implementation(添加 url() 会破坏 hook_mail 实现)
        • <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 实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 的问题)
                  <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>
                          <tbody id='nl9Aq'></tbody>
                      • <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'>