I need to check if an URL address contains some text. so I created this code.
function url_mapping_name( $urlname ) {
if (str_contains($urlname, 'amazon.de')) {
echo "amazon;
}
if (str_contains($urlname, 'brickset')) {
echo 'brickset';
} else {
echo 'no URL';
}
I am trying to say. Look for "amazon.de" in $urlname, if the URL contains amazon.de return amazon, if the URL contains brickset.com return brickset, if nothing found return no URL
But something is wrong and I do know where I did a mistake
Thanks for helping me.
Aucun commentaire:
Enregistrer un commentaire