Html 在我的 index.php(wordpress 主题)中确实存在解析错误
Html does parsing error in my index.php (wordpress theme)
我正在构建自己的 wordpress 主题。我对 html 和页面相关的东西并不陌生,但从未为 php 编写代码行。我想继续更复杂的 cms - wordpress。现在我不明白为什么,但我的页面出于某种原因抛出了解析错误。
Parse error: syntax error, unexpected ... on line ##
这是我的部分代码,包括 html in php:
<?php
if (have_posts()) :
while (have_posts()) : the_post();
<h2>Title here</h2> /* says error is on this line */
endwhile;
else :
echo '<p>No content found</p>'
endif; /* also error is on this line */
?>
我正在使用 Dreamweaver,但我想这不是解决这个问题的关键。
试试这个。缺少一个回声和分号。
if (have_posts()) :
while (have_posts()) : the_post();
echo '<h2>Title here</h2>'; /* says error is on this line */
endwhile;
else :
echo '<p>No content found</p>';
endif; /* also error is on this line */
<?php
if (have_posts()) :
while (have_posts()) : the_post();
?>
<h2>Title here</h2> /* says error is on this line */
<?php
endwhile;
else :
echo '<p>No content found</p>'
endif; /* also error is on this line */
?>
这对你有帮助....
我正在构建自己的 wordpress 主题。我对 html 和页面相关的东西并不陌生,但从未为 php 编写代码行。我想继续更复杂的 cms - wordpress。现在我不明白为什么,但我的页面出于某种原因抛出了解析错误。
Parse error: syntax error, unexpected ... on line ##
这是我的部分代码,包括 html in php:
<?php
if (have_posts()) :
while (have_posts()) : the_post();
<h2>Title here</h2> /* says error is on this line */
endwhile;
else :
echo '<p>No content found</p>'
endif; /* also error is on this line */
?>
我正在使用 Dreamweaver,但我想这不是解决这个问题的关键。
试试这个。缺少一个回声和分号。
if (have_posts()) :
while (have_posts()) : the_post();
echo '<h2>Title here</h2>'; /* says error is on this line */
endwhile;
else :
echo '<p>No content found</p>';
endif; /* also error is on this line */
<?php
if (have_posts()) :
while (have_posts()) : the_post();
?>
<h2>Title here</h2> /* says error is on this line */
<?php
endwhile;
else :
echo '<p>No content found</p>'
endif; /* also error is on this line */
?>
这对你有帮助....