这是一个社交分享脚本。我想回显每个数组以显示链接。有人可以解释一下我该怎么做吗?
这是分享按钮部分
function simple_social_sharing( $attr_twitter = null, $attr_items = null ) {
$share_items = array ();
// set each item
$item_facebook = array(
"class" => "facebook",
"href" => "http://www.facebook.com/sharer.php?u={$url}&t={$browser_title_encoded}",
"text" => "Share on Facebook"
);
$item_twitter = array(
"class" => "twitter",
"href" => "http://twitter.com/share?text={$page_title_encoded}&url={$url}&via={$twitter_account}",
"text" => "Share on Twitter"
);
// test whether to display each item
if($item_toggles) {
// explode into array
$item_toggles_array = explode( ",", $item_toggles );
// set each item on or off
$show_facebook = $item_toggles_array['0'];
$show_twitter = $item_toggles_array['1'];
}
else {
$display_all_items = 1;
}
// form array of items set to 1
if( $show_facebook==1 || $display_all_items ) {
array_push( $share_items, $item_facebook );
}
if( $show_twitter==1 || $display_all_items) {
array_push( $share_items, $item_twitter );
}
// if one or more items
if ( ! empty( $share_items ) ) {
// create output
foreach ( $share_items as $share_item ) {
$share_output = "<a class=\"ss-share-link ico-{$share_item['class']}\" href=\"{$share_item["href"]}\" rel=\"nofollow\" target=\"_blank\">{$share_item['text']}</a>\n";
}
// echo output
echo $share_output;
}
}
我试图通过这种方式来做到这一点echo simple_social_sharing($share_output[1]); 但没有奏效。