douren0558 2017-06-08 03:45
浏览 57

警告:date():并且无法修改联系表单上的标题信息

i had a little contact form from the net and trying to insdtall it but i am getting these 2 errors and i must admit, i am not very good with php esp server side. the errors are:

Error 1: *Warning: date(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function.* contactform/include/class.phpmailer.php on line 1612 and the same warning for line 1616 of the same file class.phpmailer.php

line 1612 to line 1616 of class.phpmailer.php is

1612- $tz = date('Z');
1613- $tzs = ($tz < 0) ? '-' : '+';
1614- $tz = abs($tz);
1315- $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
1316- $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);

Error 2: Warning: Cannot modify header information - headers already sent by (output started at /home/massa/public_html/mydomain.com/folder/contactform/include/class.phpmailer.php:1612) in /home/massa/public_html/mydomain.com/folder/contactform/include/fgcontactform.php on line 143

line 143 of fgcontactform.php is .

143-  header("Location: $url");
144-  exit;

I must specity this are not my codes, its just a free basic contact form i had on internet and try to implement it on my site.. Any help will be appreciated. Just how to insert the right time zone on line 1612 and what to insert in line 143 of the other file.. Thanks in advance. Michelle

  • 写回答

1条回答 默认 最新

  • donglian1523 2017-06-08 03:52
    关注

    The problem is in your php.ini settings. Follow the warning's suggestion and either edit the file and add this:

    date.timezone="Australia/Sydney"
    

    Or alternatively, add the call to date_default_timezone_set("Australia/Sydney") somewhere in the beginning of your code.

    Once the error is resolved, your other problem will be gone as well. PHP echoes all errors it encounters and unless your output is buffered, it will send the HTTP response headers along with the first thing it outputs. After that it will be too late to use header('Location: ...') because the headers are already sent to the client.

    评论

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c