2012-08-31 34 views
-1

也許我開始是盲目的,但我有殺了我一個問題,我 有一個功能,我得到這個錯誤信息:PHP - 解析錯誤:語法錯誤,意想不到的「[」

Parse error: syntax error, unexpected '[' in /home/largo/public_html/dev/wp-content/plugins/email-key/email-key.php on line 28

in this line:

$ 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'] = '[email protected]'; 

return $dummy_components; 
} 

回答

7

變化

$to = components['recipient']; 

$to = $components['recipient']; 

我猜。

+0

哦,我的上帝,所以這麼愚蠢 感謝bkwint –

+0

NP,可以發生在任何人,只接受一個答案建多一點正確的聲譽。 – bkwint

4

變化:

$to = components['recipient']; 

$to = $components['recipient']; 

這就是爲什麼有一個內置的PHP解析器會爲您節省時間的IDE。

3

變化$to = components['recipient'];$to = $components['recipient'];

2

你錯過了$

$to = $components['recipient']; 
3

行:

$to = components['recipient']; 

這樣:

$to = $components['recipient']; 
相關問題