Home > Backend Development > PHP Tutorial > 如何把这段html代码转换成php代码

如何把这段html代码转换成php代码

WBOY
Release: 2016-06-13 12:20:17
Original
1996 people have browsed it

怎么把这段html代码转换成php代码
是这样的,我有一个wordpress网站,偶尔在网上看见一个设计的挺不错的作者说明的页面,这个作者也把html代码和CSS分享出来了,只需要把这段html代码放在我网站里的single.php里边。但是html和php代码好像不能放在一起,放进去之后文章页面根本就打不开了,想请教一下怎么把这段html代码改成这种php代码?

这个是我搜到的作者说明页面,其实就是一个小模块,我觉得挺有意思的。


这个是它的html代码

<div class="article-author"><br /><div class="article-author-title">文章发表于<?php the_modified_time('Y/n/j'); ?></div> <br /><div class="avatar"><?php echo get_avatar( get_the_author_email(), '80' ); ?></div><br /><h4>本文作者:<?php the_author_posts_link(); ?> </h4><br /><p><span   style="max-width:90%"><br />  <?php the_author_description(); ?></span></p><p> | <br /><a rel="nofollow" href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a>  |   <br /><a rel="nofollow" target="_blank" href="http://weibo.com/mapler123">新浪微博</a>  |   <br /><a rel="nofollow" target="_blank" href="http://t.qq.com/mapler123">腾讯微博</a>  |   <br /><a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=jubt5fzO_Of_oP--oO3h4w">联系站长</a>  | </p><br /></div>
Copy after login


这个是我的single.php里面的一段代码
echo "\t\t<div class=\"action-share bdsharebuttonbox\">\r\n\t\t\t";<br />_moloader("mo_share");<br />echo "\t\t</div>\r\n\t\t<div class=\"article-tags\">";<br />the_tags("标签:", "", "");<br />echo "</div>\r\n\t\t";<br />_the_ads($name = "ads_post_02", $class = "asb-post asb-post-02");<br />echo "\t\t";<br /><br />echo "<nav class=\"article-nav\">\r\n\t\t\t<span class=\"article-nav-prev\">";<br />previous_post_link(__("上一篇", "haoui") . "<br>%link");<br />echo "</span>\r\n\t\t\t<span class=\"article-nav-next\">";<br />next_post_link(__("下一篇", "haoui") . "<br>%link");<br />echo "</span>\r\n\t\t</nav>\r\n\t\t";
Copy after login


很明显两种格式不同,求大神教下怎么改动,我尝试了几次都不行,不会改
------解决思路----------------------
这样?
<br />echo '<div class="article-author">';<br />echo '<div class="article-author-title">文章发表于'.the_modified_time('Y/n/j').'</div> ';<br />echo '<div class="avatar">'.get_avatar( get_the_author_email(), '80' ).'</div>';<br />echo '<h4>本文作者:'.the_author_posts_link().'</h4>';<br />echo '<p><span style="font-size: 10pt;color: #ff0000;">';<br />echo the_author_description().'</span></p><p> <br><font color='#FF8000'>------解决思路----------------------</font><br> ';<br />echo '<a rel="nofollow" href="'.bloginfo('url').'">'.bloginfo('name').'</a>  <br><font color='#FF8000'>------解决思路----------------------</font><br>  '; <br />echo '<a rel="nofollow" target="_blank" href="http://weibo.com/mapler123">新浪微博</a>  <br><font color='#FF8000'>------解决思路----------------------</font><br>   '<br />echo '<a rel="nofollow" target="_blank" href="http://t.qq.com/mapler123">腾讯微博</a>  <br><font color='#FF8000'>------解决思路----------------------</font><br>   '<br />echo '<a rel="nofollow" target="_blank" href="http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=jubt5fzO_Of_oP--oO3h4w">联系站长</a>  <br><font color='#FF8000'>------解决思路----------------------</font><br> </p>'<br />echo '</div>';<br />
Copy after login

------解决思路----------------------
晕heredoc搞掂。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template