带PHP的PHP多行字符串 [英] PHP multiline string with PHP
本文介绍了带PHP的PHP多行字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要回应很多PHP和HTML。
I need to echo a lot of PHP and HTML.
我已经尝试了很明显的,但它不起作用:
I already tried the obvious, but it's not working:
<?php echo '
<?php if ( has_post_thumbnail() ) { ?>
<div class="gridly-image"><a href="<?php the_permalink() ?>"><?php the_post_thumbnail('summary-image', array('class' => 'overlay', 'title'=> the_title('Read Article ',' now',false) ));?></a>
</div>
<?php } ?>
<div class="date">
<span class="day">
<?php the_time('d') ?></span>
<div class="holder">
<span class="month">
<?php the_time('M') ?></span>
<span class="year">
<?php the_time('Y') ?></span>
</div>
</div>
<?php } ?>';
?>
我该怎么做?
How can I do it?
推荐答案
您不需要输出 php
标记:
You don't need to output php
tags:
<?php
if ( has_post_thumbnail() )
{
echo '<div class="gridly-image"><a href="'. the_permalink() .'">'. the_post_thumbnail('summary-image', array('class' => 'overlay', 'title'=> the_title('Read Article ',' now',false) )) .'</a></div>';
}
echo '<div class="date">
<span class="day">'. the_time('d') .'</span>
<div class="holder">
<span class="month">'. the_time('M') .'</span>
<span class="year">'. the_time('Y') .'</span>
</div>
</div>';
?>
这篇关于带PHP的PHP多行字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文