网站根目录
文章链接:https://cloud.tencent.com/developer/article/1151802
红色字体即为前缀,绿色即为后缀
<?php
include ( "wp-config.php" ) ;
require_once (ABSPATH.'wp-blog-header.php');
global $wpdb;
$qianzui = "https://www.qcgzxw.cn/";//填你的前缀
$houzui = ".html";//填你的后缀
$sql="SELECT ID FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY ID DESC ";
$myrows = $wpdb->get_results($sql);
foreach ($myrows as $b) {
echo $qianzui;
echo $b->ID;
echo $houzui."<br/>";
}
?>
缺点:只能显示原始链接
<?php
include ( "wp-config.php" ) ;
require_once (ABSPATH.'wp-blog-header.php');
global $wpdb;
$sql="SELECT guid FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY ID DESC ";
$myrows = $wpdb->get_results($sql);
foreach ($myrows as $b) {
echo $b->guid."<br/>";
}
?>
<?php
include ( "wp-config.php" ) ;
require_once (ABSPATH.'wp-blog-header.php');
global $wpdb;
$CID = 1;//分类id
$sql="SELECT ID,post_title,post_content FROM wp_posts,wp_term_relationships,wp_term_taxonomy WHERE ID=object_id and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id and post_type='post' and post_status = 'publish' and wp_term_relationships.term_taxonomy_id = $CID and taxonomy = 'category' order by ID desc";
$myrows = $wpdb->get_results($sql);
foreach ($myrows as $b) {
echo $b->ID."<br />";
}
?>
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。