2024年10月11日 建站教程
很多站长都会批量建站,那么,如果是wordpress建站如何调用其他网站的文章呢?下面web建站小编给大家简单介绍一下实现方法!
新建一个call.php文件
<?php
define('WP_USE_THEMES', false);
require('./wp-load.php');
query_posts('showposts=1');
?>
<?php while (have_posts()): the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><?php echo mb_strimwidth(strip_tags(apply_filters('the_title',$post->post_title)), 0, 50," "); ?></a></li>
<?php endwhile; ?>
在页面中调用以下代码:
<?php
ini_set("user_agent","Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)");
$url="https://网站域名/call.php";
echo file_get_contents( $url );
?>
本文链接:http://so.lmcjl.com/news/15122/