The fullUrl method in the PHP illuminate/http Request package library returns the full URL for the current request. This includes the protocol, domain, path, and query string.
Example 1:
If the current request URL is "https://example.com/posts?id=123", the fullUrl() method will return "https://example.com/posts?id=123".
Example 2:
If the current request URL is "http://localhost:8000/admin/users", the fullUrl() method will return "http://localhost:8000/admin/users".
Code example:
// Import the necessary classes use Illuminate\Http\Request;
// Create a new instance of the Request class $request = new Request;
// Get the full URL of the current request $url = $request->fullUrl();
// Print the URL to the screen echo $url;
Output:
"https://example.com/posts?id=123"
In the above example, we created a new instance of the Request class and called the fullUrl() method on it to retrieve the current URL. We then printed the URL to the screen using the echo statement.
Overall, the fullUrl() method is a useful tool in the Illuminate/http package library for getting the complete URL for any given request.
PHP Illuminate\Http Request::fullUrl - 30 examples found. These are the top rated real world PHP examples of Illuminate\Http\Request::fullUrl extracted from open source projects. You can rate examples to help us improve the quality of examples.