SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
Introducing CodeIgniter Framework in PHP

In this article you will see how use MVC in PHP through the CodeIgniter
framework. CodeIgniter is an Application Development Framework - a
toolkit. Using CodeIgniter you can develop projects much faster than with
the core PHP. The CodeIgniter framework is fully based on the MVC
architecture. CodeIgniter lets you creatively focus on your project by
minimizing the amount of code needed for a given task. You can download
the CodeIgniter framework from: "http://codeigniter.com/".

How to Install CodeIgniter

First of all extract the zip file of CodeIgniter. After extracting the CodeIgniter
file you will paste in the following position "c:wampwww" (paste) or
c:xampphtdocs (paste).

Set URL in CodeIgniter

For setting the URL in CodeIgniter go to the local disk C->wamp->www-
>CodeIgniter->open CodeIgniter->open application folder->open config
folder->open config.php file->write the following URL:

$config['base_url']='http://localhost/CodeIgniter/';

Creating the First Application in the CodeIgniter Framework

<?php
class Hello extends CI_Controller
{
  public function index()
  {
    echo "Hello Vineet !!";
  }
}
?>

This file is to be saved in
c:wampwwwCodeIgniterapplicationcontrollershello.php. Here
CI_Controller is the predefined class which is stored in the
c:wampwwwCodeIgnitersystemcorecontroller.php.




                      www.vineetsaini.wordpress.com
Output

Open the web browser and write the following URL:

"http://localhost/CodeIgniter/index.php/hello/"




Create Second Application in CodeIgniter Framework

If you want to make your own function in CodeIgniter then you can do that
like this:

<?php
class Hello extends CI_Controller
{
  public function index()
  {
    echo "Hello Vineet !!";
  }
  function test()
  {
    echo "Vineet Kumar Saini is MCA Qualified!!";
  }
}
?>

This file is to be saved in
c:wampwwwCodeIgniterapplicationcontrollershello.php.




                    www.vineetsaini.wordpress.com
Output

Open the web browser and write the following URL:

"http://localhost/CodeIgniter/index.php/hello/test/"




Create Application Using Views

<?php
class Hello extends CI_Controller
{
  public function index()
  {
    echo "Hello Vineet !!";
  }
  function test()
  {
     $this->load->view ('you'); //you is the views file
  }
}
?>

This file is to be saved in
c:wampwwwCodeIgniterapplicationcontrollershello.php.

Now we will create a view file like this:




                      www.vineetsaini.wordpress.com
<?php
echo "Vineet Kumar Saini is a Software Developer!!";
?>

This file is to be saved in
c:wampwwwCodeIgniterapplicationviewsyou.php.

Output

Open the web browser and write the following URL:

"http://localhost/CodeIgniter/index.php/hello/test/"




Conclusion

So in this article you saw how to create an application in the CodeIgniter
framework in PHP. Using this article one can easily understand creation of
the application in the CodeIgniter framework in PHP.




                     www.vineetsaini.wordpress.com

Mais conteúdo relacionado

Destaque (10)

PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
Introduction to codeigniter
Introduction to codeigniterIntroduction to codeigniter
Introduction to codeigniter
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 

Mais de Vineet Kumar Saini

Mais de Vineet Kumar Saini (20)

Abstract Class and Interface in PHP
Abstract Class and Interface in PHPAbstract Class and Interface in PHP
Abstract Class and Interface in PHP
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHP
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
Stripe in php
Stripe in phpStripe in php
Stripe in php
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Install Drupal on Wamp Server
Install Drupal on Wamp ServerInstall Drupal on Wamp Server
Install Drupal on Wamp Server
 
Joomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDFJoomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDF
 
Functions in PHP
Functions in PHPFunctions in PHP
Functions in PHP
 
Sorting arrays in PHP
Sorting arrays in PHPSorting arrays in PHP
Sorting arrays in PHP
 
Dropdown List in PHP
Dropdown List in PHPDropdown List in PHP
Dropdown List in PHP
 
Update statement in PHP
Update statement in PHPUpdate statement in PHP
Update statement in PHP
 
Delete statement in PHP
Delete statement in PHPDelete statement in PHP
Delete statement in PHP
 
Implode & Explode in PHP
Implode & Explode in PHPImplode & Explode in PHP
Implode & Explode in PHP
 
Types of Error in PHP
Types of Error in PHPTypes of Error in PHP
Types of Error in PHP
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
 
Arrays in PHP
Arrays in PHPArrays in PHP
Arrays in PHP
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

CodeIgniter in PHP

  • 1. Introducing CodeIgniter Framework in PHP In this article you will see how use MVC in PHP through the CodeIgniter framework. CodeIgniter is an Application Development Framework - a toolkit. Using CodeIgniter you can develop projects much faster than with the core PHP. The CodeIgniter framework is fully based on the MVC architecture. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task. You can download the CodeIgniter framework from: "http://codeigniter.com/". How to Install CodeIgniter First of all extract the zip file of CodeIgniter. After extracting the CodeIgniter file you will paste in the following position "c:wampwww" (paste) or c:xampphtdocs (paste). Set URL in CodeIgniter For setting the URL in CodeIgniter go to the local disk C->wamp->www- >CodeIgniter->open CodeIgniter->open application folder->open config folder->open config.php file->write the following URL: $config['base_url']='http://localhost/CodeIgniter/'; Creating the First Application in the CodeIgniter Framework <?php class Hello extends CI_Controller { public function index() { echo "Hello Vineet !!"; } } ?> This file is to be saved in c:wampwwwCodeIgniterapplicationcontrollershello.php. Here CI_Controller is the predefined class which is stored in the c:wampwwwCodeIgnitersystemcorecontroller.php. www.vineetsaini.wordpress.com
  • 2. Output Open the web browser and write the following URL: "http://localhost/CodeIgniter/index.php/hello/" Create Second Application in CodeIgniter Framework If you want to make your own function in CodeIgniter then you can do that like this: <?php class Hello extends CI_Controller { public function index() { echo "Hello Vineet !!"; } function test() { echo "Vineet Kumar Saini is MCA Qualified!!"; } } ?> This file is to be saved in c:wampwwwCodeIgniterapplicationcontrollershello.php. www.vineetsaini.wordpress.com
  • 3. Output Open the web browser and write the following URL: "http://localhost/CodeIgniter/index.php/hello/test/" Create Application Using Views <?php class Hello extends CI_Controller { public function index() { echo "Hello Vineet !!"; } function test() { $this->load->view ('you'); //you is the views file } } ?> This file is to be saved in c:wampwwwCodeIgniterapplicationcontrollershello.php. Now we will create a view file like this: www.vineetsaini.wordpress.com
  • 4. <?php echo "Vineet Kumar Saini is a Software Developer!!"; ?> This file is to be saved in c:wampwwwCodeIgniterapplicationviewsyou.php. Output Open the web browser and write the following URL: "http://localhost/CodeIgniter/index.php/hello/test/" Conclusion So in this article you saw how to create an application in the CodeIgniter framework in PHP. Using this article one can easily understand creation of the application in the CodeIgniter framework in PHP. www.vineetsaini.wordpress.com