S
S
santavits2019-11-13 14:43:29
linux
santavits, 2019-11-13 14:43:29

How to fix the link when sending?

The task is such that users send links of this type
https://site.ru and https://site.ru/ (with a slash at the end of the link) through the form.
Then these links are sent to the database.
Tell me how to make it so that if there is no slash at the end of the link, it is substituted automatically and after that it is only sent to the database
Thanks in advance

Answer the question

In order to leave comments, you need to log in

7 answer(s)
P
planc, 2018-10-26
@riddlr

https://wiki.gentoo.org/wiki/Simple_sandbox

M
mikeyuri, 2018-10-26
@mikeyuri

sudo

J
jcmvbkbc, 2018-10-27
@jcmvbkbc

ssh -X Б@127.0.0.1 "chromium-browser"

M
Michael Galyuk, 2018-10-27
@robux

1. You can type in the terminal:

su user2
chromium-browser

2. But I guess the author wants the browser to create a profile in a different folder. To do this, just add the " user-data-dir " parameter and run from the terminal:
3. Better make chromium2.sh with this command:
#!/usr/bin
/usr/bin/chromium-browser --user-data-dir="/home/user/chromium2"

4. Better yet, place the chromium2.desktop file in the /home/user/Desktop folder with the following content:
[Desktop Entry]
Version=1.0
Terminal=false
Exec=/usr/bin/chromium-browser --user-data-dir="/home/user/chromium2"
Icon=chromium-browser
Type=Application
Categories=Network;
StartupNotify=true
Name=Chrome2
I have 3 such "browsers" done.
PS You can set the second parameter --proxy-server="111.222.111.222:8888" to specify http proxy servers or --proxy-server="socks5://127.0.0.1:9050" for socks5 servers. Recommend.

I
Ingvar, 2018-10-27
@take

..
..

A
Artem Ivanov, 2019-11-13
@santavits

$url = "https://site.ru";
if ( substr($url, -1) != "/" ) // если последний символ НЕ слеш, то
{
    $url.= "/"; // дописываем его
}
echo $url;

N
nokimaro, 2019-11-13
@nokimaro

Another option

//убираем справа любое кол-во слешей если они есть и добавляем свой обязательный слеш
$url = rtrim($url, '/').'/';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question