Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress中出现意外的T_字符串_Php_Wordpress_Loops - Fatal编程技术网

Php Wordpress中出现意外的T_字符串

Php Wordpress中出现意外的T_字符串,php,wordpress,loops,Php,Wordpress,Loops,对于这个非常常用的Wordpress代码(循环),我得到了一个意外的T_字符串错误,这是到目前为止文件中唯一的php代码。问题行是while行,这意味着if行不知何故被卷入其中 <?php if (have_posts()): while (have_ posts()) : the_ post() ?> <a href="<?php the_ permalink(); ?>"><?php the_title(); ?><

对于这个非常常用的Wordpress代码(循环),我得到了一个意外的T_字符串错误,这是到目前为止文件中唯一的php代码。问题行是
while
行,这意味着
if
行不知何故被卷入其中

<?php
  if (have_posts()): 
    while (have_ posts()) : the_ post()
?>
    <a href="<?php the_ permalink(); ?>"><?php the_title(); ?></a>
    <br>
<?php
      the_content();
    endwhile;
  endif;
?>



我是一个php新手,所以我肯定我在这里遗漏了一些明显的东西。

你可能在
have_u.posts()
the_u.post()
the_u.permalink()
中有一个额外的空间
have_u.posts()
the_u.post()
the_u.permalink()

您调用的是
,而不是
,后者后面还需要一个分号:

while( have_posts() ) : the_post();
我看到你在
have_uu\posts()
中也犯了同样的错误


此外,还有一个专为WordPress online提供的StackExchange网站,您可能会发现该网站在处理WP项目时特别有用。

您调用的是
the u post()
,而不是
the u post()
,后者还需要后跟分号:

while( have_posts() ) : the_post();
我看到你在
have_uu\posts()
中也犯了同样的错误


此外,还有一个专门为WordPress online提供的StackExchange网站,您可能会发现该网站在处理WP项目时特别有用。

您在以下位置的不合适位置有一些空间:

while (have_ posts()) : the_ post()?> //should be have_posts() & the_post()

<a href="<?php the_ permalink(); ?>" //should be the_permalink()
while(have_uposts()):the_upost()?>//应该是have_posts()&the_post()

您在以下位置的不合适位置有一些空间:

while (have_ posts()) : the_ post()?> //should be have_posts() & the_post()

<a href="<?php the_ permalink(); ?>" //should be the_permalink()
while(have_uposts()):the_upost()?>//应该是have_posts()&the_post()

在我看来,这比php更像python。在我看来,这比php更像python。就是这样。真不敢相信我错过了!就这样。真不敢相信我错过了!