PHP code example of hmz / hm-zframe

1. Go to this page and download the library: Download hmz/hm-zframe library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hmz / hm-zframe example snippets


|--hmz/view/View.php
|  |--View.php 不做具体的事情,只负责调用Base里的方法,主要作用是为了在调用方法的时候可以随意使用静态或实例化调用
|  |  |--__call方法,调用类里不存在方法时触发用来接收方法名和参数
|  |  |--__callStatic方法,调用类里不存在的静态方法时触发用来接收方法名和参数
|  |  |--runParse方法,用来接收上面两个方法接收的方法名然后new Base类,调用Base类里的对应方法

|--hmz/view/Base.php
|  |--Base.php 处理类,用来处理用户提交上来的请求,加载页面和分配变量
|  |  |--make方法,用来接收传进来的参数并存入file属性中,主要用于分配模板
|  |  |--with方法,用来接收传进来的参数并存入date属性中,主要用于分配变量
|  |  |--__toString方法,加载模板,分配变量,在echo一个对象的时候会触发,使用这个方法主要是为了能
|  |  |  够在调用的时候无需注意make和with的顺序,书写起来更方便,为了达成这个效果,需要echo输出对象
|  |  |  (tips:需要注意的是为了不报语法错误,__toString必须要返回一个东西,一般默认返回空字符串)

|--hmz/model/Model.php
|  |--Model.php 不做具体的事情,只负责调用Base里的方法,主要作用是为了在调用的时候可以随意使用静态和实例化方式