Domestic PHP development framework myqee novice quick start tutorial, myqee introductory tutorial_PHP tutorial

WBOY
Release: 2016-07-13 10:23:18
Original
972 people have browsed it

Domestic PHP development framework myqee quick start tutorial for newbies, myqee introductory tutorial

1. Environment.

The author's environment is win7 32bit ultimate version. I use xampp1.7.4 (the php version 1.8.x is too high, I personally think php 5.3X is more practical) + the latest version of mq. The focus is on configuring the virtual machine,
Refer to http://www.bkjia.com/article/52123.htm

The local xampp is installed on the D drive, giving my configuration: virtual machine configuration file path D:xamppapacheconfextrahttpd-vhosts

Copy code The code is as follows:

#mq

DocumentRoot "D:/xampp/htdocs/mq/"
ServerName mq

Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all



DocumentRoot "D:/xampp/htdocs/"
ServerName localhost

host configuration file location
C:WindowsSystem32driversetchosts.ics
Hosts is not found on this machine. It is also possible to change hosts.ics.

2. Create a new myqee project

1. Download the latest version of myqee, github, you know.
Unzip it to the D:/xampp/htdocs/mq folder (consistent with the virtual machine configuration).
Modify config.new.php to config.php
I also need a .htacess. The one I downloaded from github has never worked. I need the one written in the official document. The content is as follows

Copy code The code is as follows:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [PT,L]

Copy a copy to the wwwroot directory.
a. Create a new project, open config.php in the root directory, and add an s project,
The configuration is as follows (put before the default configuration)

Copy code The code is as follows:

's' => array
(
          'name' => 'Default project', //Name
'dir' => 's', //Directory
         'isuse' => true, //Whether to enable
         'url' => '/',
),

Create a new directory s under b.projects. For convenience, copy defautl directly and rename it.
Create a new simplest controller helloworld.controller.php
in controllers in the s directory The content is as follows

Copy code The code is as follows:

class Controller_HelloWorld extends Controller
{
/**
* Test
​​*/
Public function action_default()
{
echo 'helloworld';
}
}

Open the browser, enter mq/index.php/helloworld, see helloold, success.
In the development environment, it is recommended to enable the debug function of myqee and add
to php.ini
Copy code The code is as follows:

;[MyQEE]
myqee.debug=On

Use with firefox + firebug.

3. Display the content in the database.

Hello world is so simple that it has little meaning in actual development. Strike while the iron is hot. Let’s do some dry stuff, read data from the database, and display it in the corresponding view.
a. Create a new config.php and place it in the s root directory and write the corresponding database configuration. The content is as follows:

Copy code The code is as follows:

/**database config*/
$config['database']['default'] = array
(
'type' => 'MySQL',
'connection' => array
(
'hostname' => '127.0.0.1',
'database' => 'mq',
'username' => 'mq',
'password' => '123456', 'persistent' => false,
),
       
'table_prefix' => '',
'charset' => 'utf8',
'caching' => false,
'profiling' => true,
);

Here I created an mq library in mysql and created a table wh_list
The ddl of wh_list is as follows, (add the content yourself).

Copy code The code is as follows:

CREATE TABLE `wh_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`) USING BTREE
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

b.model set up.
Create a new models directory in the s directory, and create a wh.model.php with the following content:

Copy code The code is as follows:

class Model_Wh extends Model
{
static function get_list()
{
$db = Database::instance();
$sql = 'select * FROM wh_list';
$arr = $db->query($sql)->as_array();
Return $arr;
}
}

Modify the helloworld controller above. The content is modified as follows:

Copy code The code is as follows:

class Controller_HelloWorld extends Controller
{
/**
* Test
​​*/
Public function action_default()
{
$view = new View('wh');
$arr = Model_Wh::get_list();
$view->set('wh', $arr);
$view->render();
}
}

Don’t get excited, if you browse the mq/index.php/helloworld just now, you will definitely get an error and there will be no view.
In views, create new wh.view.php
The content is as follows:

Copy code The code is as follows:




After refreshing, you can see the contents of the `name` column of the wh_list table.
Haha, isn’t it a great sense of accomplishment?
The novice tutorial is written here first. Disclaimer, this is just for novices to get started quickly and get a feel for the framework.

Which domestic PHP rapid development framework is better?

that supports ajax and permission management

The PHP framework is just a relatively standardized class. For ajax and permission management, you have to write your own classes.
I personally recommend thinkphp because there are many tutorials on the Internet. I am learning this framework.

I have a question about Qeephp that I want to teach Mr. Liao - PHP framework development

ror is a framework developed in ruby, and qeephp is a framework developed in php. . . There is no native rapid development language

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/840644.htmlTechArticleDomestic PHP development framework myqee quick start tutorial for newbies, myqee introductory tutorial 1. Environment. The author's environment is win7 32bit flagship Version. The php version used is xampp1.7.4 (1.8.x version is too high, personally think ph...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template