问题
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