php 意外的语法错误 T_CONSTANT_ENCAPSED_STRING

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9352932/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 06:38:52  来源:igfitidea点击:

Syntax error unexpected T_CONSTANT_ENCAPSED_STRING

phpsyntax-error

提问by Jess McKenzie

I am getting the following error syntax error, unexpected T_CONSTANT_ENCAPSED_STRINGon this line $this->email->subject($this->core_model->companyDetails()->coreCompanyName 'User Registration Confirmation');have I make a mistake with the '' and ""? I have also past the name as $data can I include this in the subject instead of the model call?

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

回答by ThiefMaster

You probably forgot a comma: Try this:

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

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

instead of

代替

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

回答by Martin.

You're missing a dot.

你少了一个点。

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

回答by wonderb0lt

Did you miss to concatenate the two strings (coreCompanyName and "User Registration Confirmation)? Write a "." between the two. See also here.

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

The code should look like:

代码应如下所示:

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