1

我是wordpress的新手。

我试过下面的代码

    header("Location: $location", true, $status);

我想将页面重定向到特定页面,我收到这种错误

    "Cannot modify header information - headers already sent by (output started at   /home/content/c/l/a/clareb23/html/client4/wp-content/plugins/featured-articles-lite/main.php:773) in /home/content/c/l/a/clareb23/html/client4/wp-includes/pluggable.php on line 870"

任何建议,将不胜感激。

4

1 回答 1

1

根据评论

你可以这样做:

<script>
  window.location = '<?php echo $location?>?myvar=true&status=<?php echo $status?>';
</script>

确保在header(...)声明之前不要在屏幕上回显/打印任何内容,并且在打开 php 标签之前没有空格,例如<?php. 把函数放在exit()后面也是一个好习惯。header()

于 2012-05-01T12:06:20.013 回答