Unknown
The URL Helper file contains functions that assist in working with URLs.
There are Two way for load URL Helper in codeigniter
Example
Class ControllerName extends CI_Controller
{
public function __constructor()
{
$this->load->helper('url');
}
}
1.Go To Application/config/
2.Open autoload.php
3.$autoload['helper'] = array('url');
This function use for get base_url of website . this url not content index.php You will need to set your base URL in application/config/config.php
Example :
ImageController.php
Class ImageController extends CI_Controller
{
public function __constructor()
{
$this->load->helper('url');
}
public function index()
{
$this->load->view('load_image');
}
}
load_image.php
<html>
<head>
<title>Load Image</title>
</head>
<body>
<?php echo base_url('assets/image/img1.jpg'); ?>
</body>
</html>
Output
http://xyz.com/blog/comment
This function use for get site_url of website . this url content index.php
ImageController.php
Class ImageController extends CI_Controller
{
public function __constructor()
{
$this->load->helper('url');
}
public function index()
{
$this->load->view('view_file');
}
}
View_file.php
<html>
<head>
<title>Load Image</title>
</head>
<body>
echo site_url("blog/comment");
</body>
</html>
Output :
http://xyz.com/index.php/blog/comment
This function use for get active url of website
This function Returns the URI segments of any page that contains this function
This function Returns your site "index" page, as specified in your config file
This function use for redirect on page to other page
This function use for Creates a standard HTML anchor link
This function use for Creates a standard HTML email link