<参考>预期,PHPStorm上的文件意外结束 [英] <reference> expected, unexpected end of file on PHPStorm

查看:87
本文介绍了<参考>预期,PHPStorm上的文件意外结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PHPStorm并显示一些有趣的错误/警告.不知道我是否跳过了配置. 例如,这是一个查询

I am using PHPStorm and having some interesting errors/warnings showing up. Not sure if I skipped configuring something. Here is a query for example,

$query  = "INSERT INTO tblperson (";
$query .= "  personName, personLname, personNumber, personPhone, personAttr";
$query .= ") VALUES (";
$query .= "  '{$personName}', '{$personLname}', {$personNumber}, {$personPhone}, '{$personAttr}'";
$query .= ")";

然后我收到以下警告:代码第一行出现预期的文件意外结尾". PHPStorm警告我的此插入语句上缺少我任何内容吗?

And I get this warning: " expected, unexpected end of file" on first line of the code. Is there anything I am missing on this insert statement that PHPStorm warns me on?

当我运行代码时,我可以插入一条记录而没有任何问题,但仍然想知道我可能还缺少一些改进.

When I run the code I can insert a record without any problems but still wonder maybe there might be an improvement that I am missing.

推荐答案

添加问题后,我继续搜索并在Stackoverflow上遇到了类似的问题,该问题暗示了SQL方言. PHPStorm在首选项"下有一个设置,我已将其从MySQL更改为<SQL Keywords>,现在它不再针对此错误发出警告. 只需确保选择了项目并更改了方言,以便下面的所有文件都将继承相同的方言.

After adding the question, I continued searching and hit a similar problem on Stackoverflow which was suggesting SQL Dialects. PHPStorm has a setting under Preferences, I have changed it from MySQL to <SQL Keywords> and now it does not warn me on this error anymore. Just make sure you have selected the project and change the dialect so that all files beneath will inherit the same dialects.

如评论所述,我使用PDO进行了更改.上面的解决方案只是避免了这个问题.

As stated in the comments, I changed using PDO. The solution above was just avoiding the issue.

这篇关于&lt;参考&gt;预期,PHPStorm上的文件意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆