B
B
besigor2015-09-25 17:25:53
PHP
besigor, 2015-09-25 17:25:53

How to cut or (replace) the beginning of a link using PHP?

Good afternoon.
Help me please!
I have a frame in my php file Frame
border="0" framespacing="0" name="frmsite" src="<?=$urlsite ?>"The bracket
<?=$urlsite ?> is a link to the YouTube video page https ://www.youtube.com/watch?v=_Tc1HCPTmqc
somehow I need to cut or (replace) the beginning
I need this - https://www.youtube.com/watch?v=
replace with this - https://www .youtube.com/embed/
what would be like this
Bracket frame border="0" framespacing="0" name="frmsite" src=" https://www.youtube.com/embed/_Tc1HCPTmqc?autoplay... " Bracket
But the link to the video is given only by these code <

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Kolegov, 2015-09-25
@besigor

<?= str_replace("watch?v=", "embed/", $urlsite) ?>

V
Vladimir Martyanov, 2015-09-25
@vilgeforce

parse_url() and forming a new URL from pieces of the old one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question