我在PHP兩個字符串:如何從下面的字符串中得到我的話?
$Str1 = "/welcome/files/birthday.php?business_id=0";
$Str2 = "/welcome/index.php?page=birthday";
我必須從這兩字符串單一功能讓字的生日。 我需要一個在兩種情況下都會返回生日的函數。
例如
function getBaseWord($word){
...
return $base_word;
}
getBaseWord('/welcome/files/birthday.php?business_id=0');
getBaseWord('/welcome/index.php?page=birthday');
兩個函數調用應該返回 「生日」。
我該怎麼做。
嗯,也許'功能getBirthdayFromString($ str){返回'生日'; }'?請提供更多信息,這個'生日'實際上是什麼。 – Gumbo
這些PHP變量字符串?或者他們實際上是URL? –
他們是字符串。返回值**回聲$ _SERVER [「REQUEST_URI」] ** –