Home  >  Article  >  PHP Framework  >  Detailed explanation of Thinkphp5 integrated grid++ report

Detailed explanation of Thinkphp5 integrated grid++ report

藏色散人
藏色散人forward
2021-02-20 17:30:222648browse

The tutorial column of thinkphp below will introduce to you how Thinkphp5 integrates grid reports. I hope it will be helpful to friends in need!

Detailed explanation of Thinkphp5 integrated grid++ report

## After checking many articles, there are very few articles on re-integration in thinkphp. Based on consulting online information and examples provided by grid, the process of integrating grid in thinkphp5 was completed.

Environment:
phpstudy, thinkphp5, grid Report6

1. Import files
<script type="text/javascript" src="__STATIC__/admin/js/GRInstall.js" ></script>
<script type="text/javascript" src="__STATIC__/admin/js/GRUtility.js" ></script>
<script type="text/javascript" src="__STATIC__/admin/js/CreateControl.js" ></script>
These three are the js used by the grid web plug-in , I put these three files in the public/admin/js directory, so... (Actually, just introduce the path wherever you put them) ######2. Make reports in the grid## ####Just follow the operating procedures######3. Insert the designer plug-in into the web page###
<script type="text/javascript"> 
    //用查询显示控件展现报表,从URL“../grf/1a.grf”获取报表模板定义,从URL“../data/DataCenter.php?data=Customer”获取XML形式的报表数据,
	CreateDisplayViewerEx("100%", "100%", "__STATIC__/grf/1a.grf", "__STATIC__/data/DataCenter.php?data=Student", true, "");
</script>
###3. Write the controller code###
public function DisplayViewReport() {

     return $this->fetch();
	}
###4. Modify the database connection code ######In the mysql_GenXmlData.php file in the Data directory, fill in the mysql_connect() according to your own database server conditions, and write your own database name in mysql_select_db(). ######### This is the simplest integration case, and multi-table queries are not involved. Start simple, and complex ones will become simple! #########

The above is the detailed content of Detailed explanation of Thinkphp5 integrated grid++ report. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete