FastAdmin是一款基于ThinkPHP5+Bootstrap的极速后台开发框架。
以一个学校管理插件为例
PHPSTORM
phpstudy
nginx1.15.11
mysql8.0
php7.3.4
配置站点
我的域名设置为fast51admin.localhost.nyist.vip
安装fastadmin可以使用git克隆项目至本地或者下载安装包。
下载后解压到对应站点目录下,设置网站根目录至文件的public目录下(与tp一致)
解压后的文件
然后为网站设置对应的NGINX规则
如果成功则访问网站时可以看到,用户为admin,密码为123456
这是本次实例的规则
Note: When using phpstudy, the rules are modified in the vhost file corresponding to the website.
Take the school management instance as an example
After you successfully install fastadmin, a database fast51## will be automatically generated
#The table we want to create is also in this databaseThe third step - one-click crudThis is a powerful function of fastadmin, you can use the command line with one click Generate controllers, models, views, validators, language packs, JS, etc. corresponding to the data table.One-click command to generate crud
php think crud -t testHere
“-t”The parameter specifies the data table you want to generate (you don’t need to write the prefix name)
Common parameters-c, --controller[=CONTROLLER] Generated controller name, optional, automatically parsed based on table name by defaultOne-click command to generate menu
php think menu -c testHere
"-c"The parameter specifies the controller
One-click command to generate addon
php think addon -a mydemo -c createHere
“-a”The parameter specifies the name of the add-on
That is where the files we generated in the previous steps are located
Step 7 - Implement the plug-in
Export all our data tables and merge them into install.sql
Need to correspond in the plug-in directory Create the background management menu of the plug-in in the plug-in name.php.
Note: install.sql will be executed when the plug-in is installed for the first time
Step 8 - Packing the plug-in
php think addon -a mydemo -c packageManual packaging
Enter the plug-in directory you want to package, select all files, and compress them into zip packages
Summary
Official documentation link: https://doc.fastadmin.net/docs
Official plug-in documentation link: https://doc.fastadmin.net/developer/55.html
The above is the detailed content of Basic process of fastadmin plug-in development based on TP framework. For more information, please follow other related articles on the PHP Chinese website!