这是代码:
我无法在第二个函数中打印站点类型。当从不同的函数发送“all”作为参数时,我可以打印数组。
function site_type_find($site_type)
{
$site_type_name_array=['Youtube','Wikipedia','Mashable','Wired'];
if($site_type="all")
return $site_type_name_array;
else
return $site_type_name_array[$site_type];
}
function display_topic_category_sitetype($topic_id,$category_id,$site_type)
{
$result=mysql_query("select topic_name from topic_table where topic_id=$topic_id");
$result1=mysql_query("select category from categorytable where category_id=$category_id");
$site_type_name=site_type_find($site_type);
$resultarr=array();
$resultarr1=array();
$resultarr=mysql_fetch_array($result);
$resultarr1=mysql_fetch_array($result1);
$topic=$resultarr[0];
$catname=$resultarr1[0];
?>
<section>
<header><?php echo $topic."\n";?></header>
<article><?php echo $catname."\n";?></article>
<article><?php echo $site_type_name."\n";?></article>
<?php
}