2013-12-18 15:18
浏览 70

Aptana Studio 3无法识别.html中的PHP

When implementing code like i.e.

<!DOCTYPE html>

echo "My first PHP script!";


Next to <?php it gives red X icon with error that "<" missing '>' for end of tag. I did find some older threads about this here at stackoverflow, but there wasn't really any solution or response at all. I tried the solution of adding PHP Source Editor for .html and setting it as default, but looks like it doesn't work.

It's not a deal breaker, it's just I don't like red icons and false errors throughout the code.

图片转代码服务由CSDN问答提供 功能建议


 &lt;!DOCTYPE html&gt  ; 
&lt; html&gt; 
&lt; body&gt; 
&lt; / body&gt; 
&lt; / html&gt;  

&lt;?php 旁边,它给出了红色X图标,错误为”&lt;“ 缺少'&gt;' 标签结束。 我确实在stackoverflow找到了一些关于它的旧线程,但根本没有任何解决方案或响应。 我尝试了为.html添加PHP源代码编辑器并将其设置为默认值的解决方案,但看起来它不起作用。

这不是一个交易破坏者,它只是我没有 像整个代码中的红色图标和错误错误。

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • doukai1226 2013-12-18 15:47

    The title of your question suggests that you are saving the files as .html

    If this is the case then there will be an error as Aptana will not be looking to validate <?php ?> tags. If I'm right then you will need to save the files as filename.php and not filename.html.

    If this is not the case then you might want to change the title slightly.

    解决 无用
    打赏 举报
  • dongyuchen0214 2013-12-18 15:28

    This is because .html files are opened with HTML editor, not PHP.

    You can try to right-click on your file, then select "Open With" -> "Other ..." -> "PHP Source Editor".

    解决 无用
    打赏 举报
  • dongru3726 2015-06-03 05:49

    The tag is legit html. The file he's editing is html. The stock html editor does not flag this as an error. Sorry - I just joined and I can't "comment" yet - but my answer would be...

    This looks like a bug in the Aptana HTML editor.

    解决 无用
    打赏 举报
  • dq23171 2017-06-13 16:01

    I see this on occasion. If you're editing OPC (Other People's Code), especially WordPress code, sometimes an IF statement will be opened in one PHP file and closed in another. This is often seen in "the Loop" and is the way it's built.

    解决 无用
    打赏 举报

相关推荐 更多相似问题