Home > Backend Development > PHP Tutorial > FYB php framework - opening, fybphp framework_PHP tutorial

FYB php framework - opening, fybphp framework_PHP tutorial

WBOY
Release: 2016-07-13 10:20:59
Original
791 people have browsed it

FYB php framework - opening chapter, fybphp framework

Goals: Learning PHP framework, less code in the framework, easy to understand, easy to expand, completely object-oriented,

PHP Framework

Novices should practice basic knowledge, especially the operation of arrays, and the MVC pattern, which may be used a lot in the future. Secondly, learning the database well will facilitate the learning of the framework.
The framework actually follows some of the syntax defined by this framework. Extension development, possibly leveraging his architecture, will increase code reuse. Currently the more popular ones are ZF, YII and the domestic THINKPHP, but in the final analysis, the frameworks are all in MVC mode, and you can write them yourself in the future.

How to use the php development framework, new to the framework

Normally I don't speak either. Today I’ll write a code for you to see: Simple Model layer
product.class.php:
class product{
public function getAllProducts(){
$q= "SELECT * FROM Product";
$r=$db->query($q);
$proArr=array();
while($row=db->fetchAssoc($r )){
$proArr[]=$row;
}
return $proArr;

}
?>
View and control layer:
getallproducts.php:
$product=new product();
$ps=$product->getAllProducts();

foreach($ps as $p ){
//Output the
found in the database echo $p['name'];
}

This is how I usually write PHP. When programming with arrays,
most of them output SQL statements and nest HTML in the page, which makes the page bloated and difficult to maintain and expand.
It is easier to modify after layering in this way

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/864304.htmlTechArticleFYB php framework - opening chapter, fybphp framework goal: learning PHP framework, the framework has less code and is simple and easy to understand , easy to expand, completely object-oriented, novices of the PHP framework should practice the basics...
Related labels:
php
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