Unexpected T CONSTANT ENCAPSED STRING in CODE on line 2 [closed]

夙愿已清 提交于 2019-12-25 17:17:19

问题


Hello I am working on making a blog php script and I cant get it to work. I keep getting a error.

If it is useful I am using Microsoft WebMatrix 3.

<?php
Print "<div class=""post"">
     <h2 class=""title""><a href=""#"">" .$info['title'] ."</a>
         </h2><p class=""meta"">Posted by <a href=""#"">" .$info['name'] ."</a>".$info['date'] ."<div class=""entry""><p>".$info['post']"</p></div></div>"; ?>

回答1:


PHP doesn't support double " marks as a method of escaping. You need to use a \:

print "<div class=\"post\">";

Even better, wrap the string in ' characters, which won't interfere with them:

print '<div class="post">';

On a side note, <p class="meta"> isn't closed in your HTML - have a look over it.



来源:https://stackoverflow.com/questions/19041003/unexpected-t-constant-encapsed-string-in-code-on-line-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!