Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get url segment in php

$uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$uri_segments = explode('/', $uri_path);

echo $uri_segments[0]; // for www.example.com/user/account you will get 'user'
Comment

PREVIOUS NEXT
Code Example
Php :: wp get logged in user id 
Php :: php artisan serve port 
Php :: sail alias 
Php :: codeigniter distinct 
Php :: php remove non alphanumeric 
Php :: smarty assign var 
Php :: php to shortcode 
Php :: get full url php 
Php :: composer require guzzlehttp/guzzle 
Php :: php get file created date 
Php :: laravel model tablename 
Php :: laravel get url segment 
Php :: wordpress fs_method direct 
Php :: php filter_var boolean 
Php :: php limit string length 
Php :: all php error report 
Php :: php filter only numbers 
Php :: Your requirements could not be resolved to an installable set of packages. 
Php :: laravel migation error 
Php :: create laravel project 8.16.1 
Php :: laravel pagination bootstrap 5 
Php :: php extract time from datetime 
Php :: use app name in laravel blade 
Php :: laravel meilisearch flush 
Php :: fix to 2 decimal places php 
Php :: order alphabetically wp php 
Php :: utf8 encode php 
Php :: key of last element php 
Php :: start server symfony command 
Php :: print all session in codeigniter 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =