【问题标题】:Cannot read an undeclared column 'smtp_port'无法读取未声明的列 \'smtp_port\'
【发布时间】:2022-12-24 11:18:53
【问题描述】:

我正在尝试获取我的应用程序的登录页面,但在输入用户名和密码后,显示错误

无法读取未声明的列“smtp_port”

无法找出此错误背后的原因。

UserPresenter.php

这是演示者类的代码段

     $this->mailer = new Nette\Mail\SmtpMailer(array(
        'host' => $mailSetting->smtp_server,
        'port' => $mailSetting->smtp_port,
        'username' => $mailSetting->from_mail,
        'password' => $mailSetting->password,
        'secure' => $mailSetting->secure_connection,
    ));

SmtpMailer.php

 public function __construct(array $options = array())
    {
        if (isset($options['host'])) {
            $this->host = $options['host'];
            $this->port = isset($options['port']) ? (int) $options['port'] : NULL;
        } else {
            $this->host = ini_get('SMTP');
            $this->port = (int) ini_get('smtp_port');
        }
        $this->username = isset($options['username']) ? $options['username'] : '';
        $this->password = isset($options['password']) ? $options['password'] : '';
        $this->secure = isset($options['secure']) ? $options['secure'] : '';
        $this->timeout = isset($options['timeout']) ? (int) $options['timeout'] : 20;
        if (!$this->port) {
            $this->port = $this->secure === 'ssl' ? 465 : 25;
        }
        $this->persistent = !empty($options['persistent']);
    }

【问题讨论】:

  • $mailSetting 是如何定义的?
  • 抱歉,无法理解您的问题..

标签: php exception nette


【解决方案1】:

看起来你的 ini 配置文件没有密钥 smtp_port,因此它无法读取或者 EOL 错位。

出于测试目的,您可以直接放置端口并先运行代码,如果它可以运行,则可以确保问题出在 smtp_port ini 密钥上。

【讨论】:

    猜你喜欢
    • 2022-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多