Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP错误有时会出现_Php_Web Services_Oop_Phpbb - Fatal编程技术网

PHP错误有时会出现

PHP错误有时会出现,php,web-services,oop,phpbb,Php,Web Services,Oop,Phpbb,我有一个脚本,它使用一些PhpBB函数向所有论坛成员发送emial。我制作了一个php页面,一个带有主题和消息的表单,并添加了可以实现这一点的phpBB函数。 问题是,有时我会出现以下错误: Fatal error: Cannot redeclare smtpmail() (previously declared in /home/**/domains/**.ca/public_html/zonemembres/includes/functions_messenger.php:896) in /

我有一个脚本,它使用一些PhpBB函数向所有论坛成员发送emial。我制作了一个php页面,一个带有主题和消息的表单,并添加了可以实现这一点的phpBB函数。 问题是,有时我会出现以下错误:

Fatal error: Cannot redeclare smtpmail() (previously declared in /home/**/domains/**.ca/public_html/zonemembres/includes/functions_messenger.php:896) in /home/**/domains/**.ca/public_html/zonemembres/includes/functions_messenger.php on line 1103
在这里您可以看到代码:

 if (!function_exists('send')) {
                        include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
                    }
                for ($i = 0, $size = sizeof($contact_users); $i < $size; $i++) {

                    $messenger = new messenger(true);

                    // Email headers
                    $messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
                    $messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
                    $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
                    $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);
                    if (!empty($contact_data['contact_reason'])) {
                        $messenger->template('contact', $contact_users[$i]['user_lang']);
                    } else {
                        $messenger->template('contact_no_reason_custom', $contact_users[$i]['user_lang']);
                    }
                    $messenger->to($contact_users[$i]['user_email'], $contact_users[$i]['username']);
                    //$messenger->to('silvian.iosub@gmail.com', $contact_users[$i]['username']);
                    $messenger->im($contact_users[$i]['user_jabber'], $contact_users[$i]['username']);
                    $messenger->from($contact_data['email']);
                    $messenger->replyto($contact_data['email']);
                    $link = 'http://www.adgmrcq.ca/zonemembres/viewtopic.php?f=' . $config_contact["contact_bot_forum"] . '&t=' . $last_topic_id[0]["topic_id"];
                    $messenger->assign_vars(array(
                        'ADM_USERNAME' => htmlspecialchars_decode($user->data['username']),
                        'ADM_EMAIL' => htmlspecialchars_decode($user->data['user_email']),
                        'SITENAME' => htmlspecialchars_decode($config['sitename']),
                        'USER_IP' => $user->ip,
                        'USERNAME' => $contact_users[$i]['username'],
                        'USER_EMAIL' => htmlspecialchars_decode($contact_data['email']),
                        'DATE' => $date,
                        'REASON' => htmlspecialchars_decode($contact_data['contact_reason']),
                        'SUBJECT' => htmlspecialchars_decode($subject),
                        'MESSAGE' => $message,
                        'LINK' => $link,
                    ));
                    $contact_users[$i]['user_notify_type'] = NOTIFY_EMAIL;
                    $messenger->send($contact_users[$i]['user_notify_type']);
                    $messenger->save_queue();
                    unset($messenger);
                }
如果(!函数_存在('send')){
include($phpbb_root_path.'includes/functions_messenger..$phpEx);
}
对于($i=0,$size=sizeof($contact_用户);$i<$size;$i++){
$messenger=新messenger(true);
//电子邮件标题
$messenger->headers('X-Anti滥用:Board服务器名-'。$config['server_name']);
$messenger->headers('X-Anti滥用:用户标识-'。$User->data['User\u标识]);
$messenger->headers('X-Anti滥用:用户名-'。$user->data['Username']);
$messenger->headers('X-Anti滥用:用户IP-'。$User->IP);
如果(!空($contact_data['contact_reason'])){
$messenger->template('contact',$contact_users[$i]['user_lang']);
}否则{
$messenger->template($contact_no_reason_custom',$contact_users[$i]['user_lang']);
}
$messenger->to($contact_用户[$i]['user_email'],$contact_用户[$i]['username']);
//$messenger->to('silvian)。iosub@gmail.com“,$contact_用户[$i]['username']);
$messenger->im($contact\u users[$i]['user\u jabber'],$contact\u users[$i]['username']);
$messenger->from($contact_data['email']);
$messenger->replyto($contact_data['email']);
$link='1http://www.adgmrcq.ca/zonemembres/viewtopic.php?f='.$config_contact[“contact_bot_forum”].&t='.$last_topic_id[0][“topic_id”];
$messenger->分配变量(数组)(
'ADM_USERNAME'=>htmlspecialchars_decode($user->data['USERNAME'),
'ADM_EMAIL'=>htmlspecialchars_decode($user->data['user_EMAIL']),
'SITENAME'=>htmlspecialchars\u解码($config['SITENAME']),
'USER_IP'=>$USER->IP,
'USERNAME'=>$contact_用户[$i]['USERNAME'],
“用户电子邮件”=>htmlspecialchars\u解码($contact\u data['EMAIL']),
“日期”=>$DATE,
“原因”=>htmlspecialchars\u解码($contact\u data['contact\u REASON']),
“主题”=>htmlspecialchars\u解码($SUBJECT),
'MESSAGE'=>$MESSAGE,
“LINK”=>$LINK,
));
$contact_users[$i]['user_notify_type']=通知电子邮件;
$messenger->send($contact_users[$i]['user_notify_type']);
$messenger->save_queue();
unset($信使);
}
这是我感兴趣的部分。
$messenger
变量在
functions\u messenger.php
文件中声明,该文件似乎声明了一个函数两次。奇怪的是,我有时会犯这样的错误。我没能找到一条规则来解释这是怎么出现的


有人有什么想法吗?谢谢

转到file/home//domains/.ca/public\u html/zonemembers/includes/functions\u messenger.php,找到函数smtpmail(),并将其包装成如下所示的if语句:

if(!function_exists('smtpmail'))
{
    function smtpmail()
    {
        // Function decleration here
    }
}