P
P
PHP Fan2021-08-11 11:25:36
Laravel
PHP Fan, 2021-08-11 11:25:36

How to remove repeated slashes in Laravel?

Help me please. There is a site on Laravel, but I can’t remove repeated slashes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
inFureal, 2021-08-19
@inFureal

trim($str, '/')- this is if there are slashes at the beginning and end of the line,
and if in the middle:

white(strpos($str, '/') !== false)
    $str = str_replace('//', '/', $str);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question