Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Laravel request URL

# Request URL-http://example.song/example/test?page=1

request()->url();
# http://example.song/example/test

request()->fullUrl();
# http://example.song/example/test?page=1

request()->fullUrlWithQuery(['filter'=>'applied']);
# http://example.song/example/test?page=1&filter=applied

request()->fullUrlWithoutQuery(['page']);
# http://example.song/example/test

request()->path();
# examples/test

request()->segment(2);
# test

request()->segments();
# ['example','test']
 
PREVIOUS NEXT
Tagged: #Laravel #request #URL
ADD COMMENT
Topic
Name
7+7 =