我創建的PHP函數調用clear_url,但我想出變量$ idc和$類型,但我不能這樣做任何人都可以告訴我該怎麼做嗎?
function clear_url($f1,$f2,$table){
include('db.php');
$sql=$Con->query("SELECT {$f1},{$f2} FROM {$table}");
$array=array();
while($rowt=mysqli_fetch_object($sql)){
$name1 = trim($rowt->$f1);
$name1 = strtolower($name1);
$name1 = stripslashes($name1);
$name1 = str_replace(" ","-",$name1);
$name1 = str_replace(".","-",$name1);
$name1 = str_replace(" ","-",$name1);
$name1 = str_replace("(","",$name1);
$name1 = str_replace(")","",$name1);
$name1 = str_replace("/","-",$name1);
$name1 = str_replace(",","-",$name1);
$name1 = str_replace("'","-",$name1);
$name1 = str_replace("&","-",$name1);
$name1 = str_replace("---","-",$name1);
$array[]=$name1.','.$rowt->$f2;
}
$leng=count($array);
for($i=0;$i<$leng;$i++){
$array[$i];
$str=$array[$i];
$sp=explode(",",$str);
if($sp[0]==$_GET['name']){
$idc=$sp[1];
$type=$sp[0];
}
}
}
你可以發佈您的代碼的功能? –
將它放在顯示器上,我們將看看 – DevDonkey
「脫離變量」是什麼意思?你想從函數中返回它們嗎?你想打印它們到輸出嗎?你需要更清楚。 – Anders