In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how the InitPHP framework to build high-availability WEB applications and create projects, the content is concise and easy to understand, can definitely brighten your eyes, through the detailed introduction of this article, I hope you can get something.
1. Download framework
Select the latest version and download it. Frame download address
two。 Create a project directory
Create a project directory with a schematic diagram:
\
1. Folder initphp is the newly downloaded initphp framework folder
2. Conf/comm.conf.php places the project profile
3. Web/controller/ folder to place controller files
4. Index.php is the project entry file
Note: projects developed with initphp are a single entry, and all requests are distributed through index.php.
3. Index.php entry file
Index.php code example
\
The entry file is very simple, define an APP_PATH variable, then import the framework initphp.php file, and finally call InitPHP::init () in the framework to run the framework.
4. Profile comm.conf.php
The comm.conf.php configuration file has been imported in the index.php portal file. If we do not configure the conf.php file ourselves, the framework automatically uses a default configuration file, initphp.conf.php, that comes with the framework
\
Our custom configuration can copy the configuration information in initphp.conf.php. There is a lot of configuration information in it, which can be filtered as needed.
Since our first tutorial only needs to use Hello World, the configuration is as follows:
\
\
We mainly configure $InitPHP_conf ['url'] and controller-related configuration parameters.
5. IndexController.php controller file
\
The index.php entry file needs to inherit the Controller base class, and Controller is a class defined in InitPHP.
You need to define a run method, which is the default Action method, the run method. This method name can be defined in the configuration.
6. Complete the project construction and run
At this time, we will output HelloWorld in our browser.
We can also access it through parameters: access. Parameter c represents the corresponding Controller name, and run represents the accessible Action method name in Controller.
\
Entry file and APP detach project
1. Project directory structure
\
two。 Why are you doing this?
1. The separation of the entry file from the app project file makes it more secure in the first place. When configuring apache or Nginx virtual machines, as long as the www directory points to the test/www directory, for the outer layer, users cannot access the files in the app folder through URL.
two。 Multiple entrances can be achieved. Through multiple entrances to Wuhan Renji Integrated traditional Chinese and Western Medicine Hospital http://www.whrjkf.com/, it is convenient for different entrances to enter different project modules.
3. Make the second-level domain name easier to implement.
3. What is the difference between this deployment and the above deployment?
To separate and deploy the entry file, you only need to modify the entry file index.php. Here's index.php.
\
The later introduction will use the deployment method of this project.
The above is how the InitPHP framework builds highly available WEB applications and creates projects. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.