在我的PHP中,我想将每个wordpress-post标记附加到URL的末尾。但它似乎返回了一个数组,并且不起作用。我所有的WordPress帖子每个只有一个标签。
<?php
$tags = get_the_tags();
$html= file_get_contents('https://www.trade-ideas.com/ticky/ticky.html?symbol=')**.'$tags'**;
$start = strpos($html,'<div class="span3 height-325"');
$end = strpos($html,'<!-- /span -->',$start);
$data= substr($html,$start,$end-$start);
echo "$data" ;
?>
感谢所有我设法做到的
<?php
$post_tags = get_the_tags();
if ( $post_tags ) {
$tags = $post_tags[0]->name;
}
$html= file_get_contents('https://www.trade-ideas.com/ticky/ticky.html?symbol='. "$tags");
$start = strpos($html,'<div class="span3 height-325"');
$end = strpos($html,'<!-- /span -->',$start);
$data= substr($html,$start,$end-$start);
echo "$data" ;