A PHP Error was encountered

Severity: Warning

Message: preg_match(): Compilation failed: unmatched closing parenthesis at offset 38

Filename: hooks/Check_user.php

Line Number: 217

Backtrace:

File: /home/b2z283hyjn3q/public_html/application/hooks/Check_user.php
Line: 217
Function: preg_match

File: /home/b2z283hyjn3q/public_html/application/hooks/Check_user.php
Line: 84
Function: getOS

File: /home/b2z283hyjn3q/public_html/application/hooks/Check_user.php
Line: 10
Function: anylisis

File: /home/b2z283hyjn3q/public_html/index.php
Line: 315
Function: require_once

Unknown What is URL Helper in codeigniter - What is Helper in Codeigniter - Codeigniter tutorial for beginners step by step in hindi | My Project HD
X

What is URL Helper in codeigniter - What is Helper in Codeigniter - Codeigniter tutorial for beginners step by step in hindi

What is URL Helper in codeigniter - What is Helper in Codeigniter - Codeigniter tutorial for beginners step by step in hindi





URL Helper in codeigniter

The URL Helper file contains functions that assist in working with URLs.

How To Load URL Helper

There are Two way for load URL Helper in codeigniter

1.load on __constructor() : 

Example 

Class ControllerName extends CI_Controller
{
    public function __constructor()
    {
        $this->load->helper('url');
    }
}

2. Load On autoload.php 

1.Go To Application/config/
2.Open autoload.php 
3.$autoload['helper'] = array('url');

Function of url helper

  1. base_url();
  2. site_url ();
  3. current_url ();
  4. uri_string ();
  5. index_page ();
  6. redirect();
  7. anchor();
  8. mailto();

1.base_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

 

2.site_url() :

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

 

3.current_url() :

This function use for get active url of website 

 

4.uri_string() :

This function Returns the URI segments of any page that contains this function

 

5.index_page() :

This function Returns your site "index" page, as specified in your config file

 

6.redirect() : 

This function use for redirect on page to other page 

 

7.anchor() :

This function use for Creates a standard HTML anchor link

 

8.mailto() :

This function use for Creates a standard HTML email link

 


Related Tutorials