Android programmers learn PHP development (34)-Automatic Generation of ThinkPHP5.0 (6)-PhpStorm

Source: Internet
Author: User
It's time to witness the miracle. we have to automatically generate the directory structure ~ This is the convenience of TP ~ Otherwise, we will use the framework instead of the native ~ It's time to witness the miracle. we have to automatically generate the directory structure ~ This is the convenience of TP ~ Otherwise, we will use the framework instead of the native ~
Online Documentation: http://www.kancloud.cn/manual/thinkphp5/118021

1. command line automatic generation

It is not convenient for demonstration. if you are interested, read the Development Manual ~

2. add automatically generated code

We add in. \ build. php as follows:

// Define the automatic generation of the demo module (based on the actual file name) 'demo' => ['_ file _' => ['common. php '],' _ dir _ '=> ['behavior', 'controller', 'model', 'View'], 'controller' => ['index', 'test', 'usertype'], 'model' => ['user', 'usertype'], 'View' => ['index/index'],],

Or, like this:

// Define the automatic generation of the index module 'index' => ['_ file _' => ['tags. php', 'user. php', 'Hello. php '],' _ dir _ '=> ['behavior', 'controller', 'model', 'View'], 'controller' => ['index', 'test', 'usertype'], 'model' => [], 'View' => ['index/index'],], // define the automatic generation of the test module 'test' => ['_ dir _' => ['behavior ', 'controller', 'model ', 'https'], 'controller' => ['index', 'test', 'usertype'], 'model' => ['user', 'usertype'], 'View' => ['index/Index', 'index/test'],],

Code, specify the directory structure, and automatically generate files.

View: The description of the custom directory automatically generated in the entry file:

Index.html:

 // + ---------------------------------------------------------------------- // [Application portal file] // define the application directory define ('app _ path', _ DIR __. '/.. /application/'); // load the framework boot file require _ DIR __. '/.. /thinkphp/start. php ';/*** method for automatically generating the directory structure 1 * // read the automatically generated definition file $ build = include '.. /build. php '; // run the automatic generation \ think \ Build: run ($ build);/*** method of automatically generating the directory structure 2 * // \ think \ Build :: module ('admin ');

3. automatically generate the default directory structure and File:

Index.html:

 // + ---------------------------------------------------------------------- // [Application portal file] // define the application directory define ('app _ path', _ DIR __. '/.. /application/'); // load the framework boot file require _ DIR __. '/.. /thinkphp/start. php ';/*** method for automatically generating the directory structure 1 * //// read the automatically generated definition file // $ build = include '.. /build. php '; // run automatically generated // \ think \ Build: run ($ build ); /*** method for automatically generating the directory structure 2 */\ think \ Build: module ('admin ');

Note that you do not need to operate build. php in this method.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.