I do the registration in my android application, and I need to access the php file on the hosting, but I do not know how to find out the url to this file.
2 answers
<?php echo 'ΠΏΡΡΡ ΠΎΡ ΠΊΠΎΡΠ½Π΅Π²ΠΎΠΉ ΠΏΠ°ΠΏΠΊΠΈ: '.$_SERVER['DOCUMENT_ROOT'].'<br>'; echo 'ΠΠΎΠ»Π½ΡΠΉ ΠΏΡΡΡ ΠΊ ΡΠΊΡΠΈΠΏΡΡ ΠΈ Π΅Π³ΠΎ ΠΈΠΌΡ: '.$_SERVER['SCRIPT_FILENAME'].'<br>'; echo 'ΠΠΌΡ ΡΠΊΡΠΈΠΏΡΠ°: '.$_SERVER['SCRIPT_NAME']; ?> - It seems
__FILE__solves the problem. - And - As far as I remember, FILE and '$ _SERVER [' DOCUMENT_ROOT ']' are the same - AseTry
- @AseTry - no, of course, these are different things .. DOCUMENT_ROOT - path to the root directory of the server - Arsen
- Well, I abandoned PhP for quite a while so I do not remember. :)] - AseTry
|
In this php file, paste this code <?php echo __FILE__; ?> <?php echo __FILE__; ?> after running the php file in it will show the full path.
- @merey nabi I recommend reading about routing requests. How to correctly associate addresses with queries, etc., try to avoid open queries. And it is desirable to make a single entry point
index.phpand send all requests forindex.php, with the desired route. - And
|