CodeIgniter URL
We have two types of URL: 1) Query URL 2) segment based URL
Example: 1) Query Based URL => https://example.com/view.php?product=20&cat=books
You can see that we can use ? and & = these are the query url.
Example: 2) Segment Based URL => https:// example.com/view/product/20/cat/books
You can see that we can use / these are the segment base url.
Understand the URL pattern
URL => https:// example.com/view/product/20/cat/books
URI => view/product/20/cat/books
URL = Base URL + URI
URL = https:// example.com + view/product/20/cat/books
Understand the CodeIgniter Url Segment
URL => https:// example.com/class/method/id
Example: class testing
{
public function welcome()
{
return "Welcome";
}
}
URL => https://example.com/testing/welcome
Note:-
- The first segment represents the controller class that should be invoked.
- The second segment represents the class method that should be called.
- The third ,and any additional segments, represent the ID and any variables that will be passed to the caontroller.
Comments
Post a Comment