Wednesday, November 14, 2018

Model Framwork CI

  Kali ini saya akan mencoba membahas sedikit salah satu freamwork yang mudah digunakan , yaitu freamwork CI. untuk pembahasan selanjutnya silahkan dibaca dan dimengerti pembahasan framwork CI           
                                                
Model Framwork CI 

> model
Models are PHP classes that are designed to work with information in your database For example, let’s say you use CodeIgniter to manage a blog. You might have a model class that contains functions to insert, update, and retrieve your blog data -insert
>Query Builder

For the sake of simplicity in this example we’re using
$_POST
more common approach would be to use the Input Library
$this->input->post('title').>Anatomy of a Model
Model classes are stored in your application/models/ directory. They can be nested within sub-directories if you want this type of organization.

The basic prototype for a model class is this:



Where Model_name is the name of your class. Class names must have the first letter capitalized with the rest of the name lowercase. Make sure your class extends the base Model class.
The file name must match the class name. For example, if this is your class:

Your file will be this:



Loading a model

Here is an example of a controller, that loads a model, then serves a view:



Auto-loading Models

If you find that you need a particular model globally throughout your application, you can tell CodeIgniter to auto-load it during system initialization. This is done by opening theapplication/config/autoload.php file and adding the model to the autoload array.




thak you..!!

No comments: