1. 程式人生 > >織夢在 extend.func.php中函式獲取標題拼音?

織夢在 extend.func.php中函式獲取標題拼音?

下面有一段程式碼,是獲取標題拼音,用拼音命檔名,
思考題:如何改成首字母,或者隨機生成字母加數字?


//獲取TAG靜態地址, 
function nic_tag_url($tid)
{
global $dsql;
$sql = "select * from #@__tagindex where id='$tid' ";
if ($arcRow = $dsql->GetOne($sql)){ 
//$str = $GLOBALS['cfg_cmspath']."/tag/".ceil($tid/100)."/".Getpinyin($arcRow["tag"])."_".$tid."_1.html"; //目錄結構為:每100個ID為一個目錄,從 /tag/1/ 開始
$pinyin_title = GetPinyin(stripslashes($arcRow["tag"]));
$pinyin_title = str_replace("?","",$pinyin_title);
$pinyin_title = str_replace(":","",$pinyin_title);
$str = $GLOBALS['cfg_cmspath']."/tag/".$pinyin_title."_".$tid."_1.html"; //目錄結構為:/tag/拼音_ID_1.html 開始
}else $str="ID為$tid的TAG已被刪除!";
return $str;
}