Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用以下代码打印出特定帖子的内容(在本例中为 103):
<?php $post_id = 103; $queried_post = get_post($post_id); echo apply_filters('the_content',$queried_post->post_content); ?>
我怎样才能让它排除所有的 html 标签,比如<p>and <br>s,只显示文本?
<p>
<br>s
谢谢!
使用 strip_tag(string) 函数从字符串中删除所有 html 标签
echo strip_tags(apply_filters('the_content',$queried_post->post_content));