【问题标题】:php code order being changed by server?服务器更改php代码顺序?
【发布时间】:2013-12-11 20:51:48
【问题描述】:

有人向我解释一下服务器或浏览器在这里做什么:

集成了一个 wordpress 博客的最后 3 个帖子以显示在非 wordpress 网站的主页上,并且只是将一些内联 CSS 样式应用于帖子:

<?php
$posts = get_posts('numberposts=3&order=ASC&orderby=post_title');
foreach ($posts as $post) : setup_postdata( $post );
echo '<span style="color:blue;font-size:10px;">'.the_date().'</span><br>';
the_title(); 
the_excerpt();
endforeach;
?>

样式不会发生,因为回显线正在由浏览器/服务器/上帝/混乱或任何在 the_date() 变量之后的东西呈现????

实际渲染代码:

<div id="blog-box">
November 11, 2013<span style="color:blue;font-size:10px;"></span><br>Hello world!<p>Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!</p>
</div>

对不起,如果我遗漏了一些明显的东西,但我不明白为什么这没有围绕日期并回显跨度代码。

谢谢。

【问题讨论】:

    标签: php css wordpress styles echo


    【解决方案1】:

    the_date() 有一个内置的echo

    试试这个

    echo '<span style="color:blue;font-size:10px;">';
    the_date();
    echo '</span><br>';
    

    【讨论】:

    • 谢谢,这行得通——内置的 echo 是 PHP 的东西,还是由 wordpress 作为该功能的一部分内置的?
    • 它由 wordpress 内置。大多数(可能是所有)以单词the_ 开头的函数都内置了回声。就像the_title()the_excerpt()the_content() 等。
    猜你喜欢
    • 2012-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-18
    • 2015-09-06
    • 1970-01-01
    • 2011-05-20
    相关资源
    最近更新 更多