S
S
sorry_i_noob2018-11-20 21:04:20
PHP
sorry_i_noob, 2018-11-20 21:04:20

A few questions about DIRECTORY_SEPARATOR?

Hello!
I wrote a web application. And instead of DIRECTORY_SEPARATOR, I used /. Why does it work on Windows? After all, in Windows you need to use \. Works great on Linux. I heard that nixes work with forward slashes too /. Why then is this constant needed?
And another question. Why should we use it in the back-end. And in the front-end'e - no? I have never seen a file connected through some DIRECTORY_SEPARATOR. Usually just like this:

<link rel="stylesheet" href="/assets/css/main.css" type="text/css">

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-11-20
@sorry_i_noob

The urls use only a regular slash, so there are no problems at the front.
On the back, the slash used in the path depends on the axis. I had problems with it, but in the furry years. Now it seems like it’s already normal, but somehow I don’t want to experiment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question