this is my code
$method = $_SERVER['PATH_INFO'];
and this is my way:
http://localhost:8082/XXXX/controllers/User.php/newUser?name=hello
the result of the method is /newUser
/newUser
I would like to have only newUser . IE without /
newUser
/
could you help me?
$method = ltrim($_SERVER['PATH_INFO'], '/');
use ltrim for the variable you want? It seems to me the easiest way
ltrim
$var = ltrim($var,"/");
$withoutSlash = substr($_SERVER['PATH_INFO'], 1);
Your question may already exist:
URL: PHP How to remove the last part of the path
One solution:
preg_replace("/\/\w+$/i","",__DIR__); # Note you may also need to add .DIRECTORY_SEPARATOR at the end.
Another solution:
dirname($path) Documentation: http://ca3.php.net/dirname
Source: https://habr.com/ru/post/1208814/More articles:git push with remote ssh removed if only verbose - gitQuery with multiple left joins - column value is incorrect - databaseCreating a Precompiled Win64 Library with Mono - monoManage RODBC dates from SQL server - dateUsing bold and italic tags with google fonts - htmlUpload Image Using HttpClient - c #What is the complexity of map / set :: insert if you provided the correct iterator hint? - c ++VBA changes automatically. Change to .range - vbaSet download folder when using FAL in TCA - typo3-6.2.xjava 2 different problems with the formula - javaAll Articles