Home > Backend Development > PHP Tutorial > ThinkPHP5 mall project practical video tutorial courseware source code sharing

ThinkPHP5 mall project practical video tutorial courseware source code sharing

黄舟
Release: 2023-03-15 15:30:01
Original
5952 people have browsed it

Thinkphp, as an open source PHP framework, has developed to this day. It is undoubtedly the most suitable framework for PHP students to learn and use in China. In addition to being simple and easy to use, the greater advantage is the complete development documentation and rich plug-ins. To meet the conditions for developing a large and medium-sized website framework, "ThinkPHP5 Mall Project Practical Video Tutorial" will take the development of a medium-sized mall as an example and lead you to learn the core technology of Thinkphp.

ThinkPHP5 mall project practical video tutorial courseware source code sharing

Course playback address: http://www.php.cn/course/546.html

The teacher’s teaching style:

The teacher’s lectures are vivid, witty, witty, and touching. A vivid metaphor is like the finishing touch, opening the door to wisdom for students; a well-placed humor brings a knowing smile to students, like drinking a glass of mellow wine, giving people aftertaste and nostalgia; a philosopher's aphorisms, cultural references Proverbs are interspersed from time to time in the narration, giving people thinking and warning.

The more difficult point in this video is the design of the ThinkPHP infinite classification module:

Infinite classification and single classification are supported. Addition, deletion, modification and query are based on ThinkPHP operations. If you You can just change your own database operations. The module itself should not write the data layer in the module, but my project classification basically includes these operations, such as addition, deletion, modification, and search, so I wrote it directly in it. I didn’t want to Repeatedly write the code for adding, deleting, modifying, and checking.
I have also uploaded two tables here. Just change the table prefix to your own. This code of test.php can be used directly in one of the methods of a certain class in your project Lib.

public function catelist(){
        $cate=D('Cate');
        //var_dump($cate->gettree());exit;
        $cateres=$cate->gettree();
        $this->assign('cateres',$cateres);
       $this->display();
    }
Copy after login

The above is a very common database display api operation. Just display the database data. To design unlimited classification, first define a gettree method in the model layer

//商品分类中查询的公共方法---无限分类
    public function gettree($p = 0,$lv = 0){
        $t = array();
     //循环打印数据表里面的数据,此时循环出来的是一个个一维数组
        foreach ($this->select() as $k => $v) {
       //检查此时的数据的parent_id是否=0
            if($v['parent_id'] == $p){
         //子栏目缩进
                $v['lv'] = $lv;
          //把数组赋值给$t
                $t[] = $v;
                //检查.合并array_merge
     $t = array_merge($t,$this->gettree($v['cate_id'],$lv+1)); } } return $t; }
Copy after login

Here we also recommend downloading source code resources:http://www.php.cn/xiazai/ learn/2118

1.3_Courseware

2.Source code

The above is the detailed content of ThinkPHP5 mall project practical video tutorial courseware source code sharing. For more information, please follow other related articles on the PHP Chinese website!

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