为了不与已存在的函数相冲突,自定义函数前面加小写的'z'

 

 

//通过ID号获取类别的链接
function zGetTypeUrl($tid)
{
 global $dsql;
 global $cfg_cmspath;
 
 $query ="select typedir from ‘#@__arctype` where id=$tid";
 
 if($row=$dsql->getone($query))
 {
  $temp=str_replace("{cmspath}",$cfg_cmspath,$row['typedir']).'/';
 }
 return $temp;
}

//通过ID号获取文章的链接
function zGetArticleUrl($id)
{
 global $dsql;
 global $cfg_cmspath;
 $query ="select id,typedir,namerule from ‘#@__arctype` where id=(select typeid from ‘#@__archives` where id = $id)"; 
 if($row = $dsql->getone($query))
 {  
  $arc=$row['namerule'];
  $type=str_replace("{cmspath}",$cfg_cmspath,$row['typedir']);
  $temp=str_replace("{typedir}",$type,$temp);
  $temp=str_replace("{aid}",$id,$temp);
 }
 return $temp;
}

 

相关文章:

  • 2021-09-17
  • 2021-12-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
相关资源
相似解决方案