How to formating url with strips in laravel?

Member

by lizzie , in category: Third Party Scripts , 10 days ago

How to formating url with strips in laravel?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lily , 10 days ago

@lizzie 

In Laravel, you can format a URL with strips using the url() helper function and the strip_tags() function.


Here's an example:

1
2
3
4
5
6
use IlluminateSupportStr;

$url = 'https://www.example.com/about-us';
$formattedUrl = strip_tags(url($url));

dd($formattedUrl);


In this example, we are first defining a URL string with some HTML tags. We then use the url() helper function to format the URL and the strip_tags() function to strip any HTML tags from the URL.


Finally, we use the dd() function to display the formatted URL.