【问题标题】:Syntax error unexpected T_CONSTANT_ENCAPSED_STRING [closed]语法错误意外 T_CONSTANT_ENCAPSED_STRING [关闭]
【发布时间】:2012-03-10 07:26:01
【问题描述】:

我在这一行$this->email->subject($this->core_model->companyDetails()->coreCompanyName 'User Registration Confirmation'); 上收到以下错误syntax error, unexpected T_CONSTANT_ENCAPSED_STRING 我是否在'' and "" 上犯了错误?我也将名称作为 $data 过去了,我可以将它包含在主题中而不是模型调用中吗?

【问题讨论】:

    标签: php syntax-error


    【解决方案1】:

    您可能忘记了逗号:试试这个:

    $this->email->subject($this->core_model->companyDetails()->coreCompanyName, 'User Registration Confirmation');
    

    而不是

    $this->email->subject($this->core_model->companyDetails()->coreCompanyName 'User Registration Confirmation');
    

    【讨论】:

      【解决方案2】:

      你少了一个点。

      $this->email->subject($this->core_model->companyDetails()->coreCompanyName.'User Registration Confirmation');
      

      【讨论】:

        【解决方案3】:

        您是否错过了连接两个字符串(coreCompanyName 和“用户注册确认”)?在两者之间写一个“.”。另见here

        代码应如下所示:

        $this->email->subject($this->core_model->companyDetails()->coreCompanyName . ' User Registration Confirmation');
        

        【讨论】:

        • 不,他只是少了一个逗号,而不是一个点
        • 主题方法好像没有两个参数...见here
        猜你喜欢
        • 2012-11-13
        • 2023-04-09
        • 2011-02-12
        • 2014-02-25
        • 2015-01-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多