Home>

Convention configuration file:thinkphp/conf/convention.php

(1) Fill in the configuration information in the configuration file (configuration file:"./xmall/conf/config.php"):

Example:

<?php
return array (
   //"Configuration item" =>"Configuration value"
   /* Database settings * /
    "db_type" =>"mysql", //database type
    "db_host" =>"localhost", //server address
    "db_name" =>"xmall", //database name
    "db_user" =>"root", //username
    "db_pwd" =>"123", //password
    "db_port" =>"3306", //port
    "db_prefix" =>"think_", //database table prefix
    "db_fieldtype_check" =>false, //whether to perform field type check
    "db_fields_cache" =>true, //enable field caching
    "db_charset" =>"utf8", //database encoding uses utf8 by default
);
?>

(2) Create a table:

create table `think_user` (
  `id` int (11) default null,  `name` varchar (30) default null,  `pwd` varchar (20) default null
) engine=innodb;

(3) Perform data insertion operation Modify the indexaction.class.php file under lib/action, the content is as follows:

<?php
class indexaction extends action {
   function index () {
     public function index () {
       $data=array (
          "id" =>"1",          "name =" =>"liuning",         "pwd" =>"asd123"
       );
       m ("user")->add ($data);
     }
   }
}
?>

(4) Execute http://localhost/xmall/index.php, new records will be generated in the database;

PS:Here are a few formatting and beautifying tools on this site.I believe that everyone can use it in future development:

php
  • Previous Analysis of CI framework file upload and image processing
  • Next CI framework supports two implementation methods of $_GET