-1

也许我开始失明了,但是我遇到了一个要杀死我的问题,我有下一个功能,并且收到以下错误消息:

解析错误:语法错误,第 28 行 /home/largo/public_html/dev/wp-content/plugins/email-key/email-key.php 中的意外 '['

在这一行:

$to = components['recipient'];

我不明白为什么。

function get_form_components($components) {
global $wpdb;
$table = $wpdb->prefix . "ebk";
$components['ebk_key'] = md5(microtime());
$sql = build_sql_insert($table,$components);
    if ($wpdb->query($sql) === FALSE) {
       //return FALSE;
    } else {
        $to = components['recipient'];
        $subject = "A message from the website " . get_bloginfo( 'name' );
        $message = "Hello,\n you getting this message because your email used in the contact form in this site: \n
        the message didn\'t sent yet and it\'s waiting in a Message queue, for the message actually will send please press the
        folowing link:\n " .$components['ebk_key'] . "\n Thanks you\n " . get_bloginfo( 'name' );
        @wp_email($to,$subject,$message);
    } 

$dummy_components = $components;
$dummy_components['recipient'] = 'hold-this-please@wpcoder.co.il';

return $dummy_components;
}
4

5 回答 5

7

改变

$to = components['recipient']; 

$to = $components['recipient']; 

我猜。

于 2012-08-31T09:06:45.480 回答
4

改变:

$to = components['recipient'];

$to = $components['recipient'];

这就是为什么拥有一个带有内置 PHP 解析器的 IDE 可以节省您的时间的原因。

于 2012-08-31T09:06:47.047 回答
3

该行:

$to = components['recipient'];

对此:

$to = $components['recipient'];
于 2012-08-31T09:17:04.927 回答
3

更改$to = components['recipient'];$to = $components['recipient'];

于 2012-08-31T09:06:59.197 回答
2

你错过了$.

$to = $components['recipient'];
于 2012-08-31T09:07:26.733 回答