Ich habe eine url: http://domain.tld/123456789abc.htmlExtract Teil der URL in php
Mein Ziel ist es, einen Einbettungscode wie diese zu erstellen:
<iframe src="http://domain.tld/embed-123456789abc-620x360.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="620" height="360"></iframe>
Aber anstatt gab mir dies:
<iframe src="http://domain.tld/embed-123456789abc.html-620x360.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="620" height="360"></iframe>
Beachten Sie die oben enthaltene ".html" (123456789abc.html-620x360) ?. Wie kann der Code ohne die ".html" aus der Quell-URL erstellt werden?
Dies ist der verwendete Code.
elseif (substr_count($link,"domain")){
$video_id = explode("/",$link);
if (isset($video_id[count($video_id)-1])){
$video_id = $video_id[count($video_id)-1];
$embed = '<IFRAME SRC="http://domain.tld/embed-'.$video_id.'-'.$width.'x'.$height.'.html" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="'.$width.'" height="'.$height.'"></iframe>';
}
Schätzen Sie die Hilfe. Vielen Dank.
Mögliches Duplikat von [So entfernen Sie eine Erweiterung aus einer Zeichenfolge (nur echte Erweiterung!)] (Http://stackoverflow.com/questions/2395882/how-to-remove-extension-from-string-only-real-extension) – 3ocene